Silverlight 4, RIA Services & TFS 2010 Build Server

前端 未结 3 692
半阙折子戏
半阙折子戏 2020-12-31 21:49

I have a Visual Studio 2010 solution file with a number of projects in it. There is a mix of Silverlight projects (acting as modules), the Silverlight Shell project and a nu

相关标签:
3条回答
  • 2020-12-31 21:58

    The simplest way I've found is to declare explicitly the dependency between Silverlight project and the project that is hosting RIA service.

    You have to open in a text editor your Silverlight project file and add a fragment to it:

    <ItemGroup>
      <ProjectReference Include="..\Path\Your.Hosting.Project\Your.Hosting.Project.csproj">
        <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
      </ProjectReference>
    </ItemGroup>
    

    This will tell msbuild to build your web service before building your Silverlight app. And it will work only when building with msbuild, VS will throw an error.

    To get it built in Visual Studio also, you have to wrap this fragment in a Target and add it to InitialTargets in Project node:

    <Target Name="MySpecialReferences">
      <ItemGroup>
        <ProjectReference Include="..\Path\Your.Hosting.Project\Your.Hosting.Project.csproj">
          <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
        </ProjectReference>
      </ItemGroup>
    </Target>
    
    <Project ... InitialTargets="MySpecialReferences" ... >
    

    Visual Studio 2010 will skip this target now but msbuild will use to change built order of projects.

    0 讨论(0)
  • 2020-12-31 22:07

    Below is a sample from an MS Build script that we're using in our project. Basically, we've labelled our web project (containing the RIA services) as a priority project and are building it first.

    Please note that the 1st XML tag should be located somewhere in the environment setup stage.

    <ItemGroup>
        <!-- use this collection to control project build order, projects listed in this array are removed from the current build queue and pushed in the front before compilation-->
        <InitialBuildProjects Include="MyProject.Web.RiaServices" />
    </ItemGroup>
    
    <ItemGroup>
            <PriorityProjects               Include="$(ProjectRootDirPath)\Sources\%(InitialBuildProjects.Identity)\%(InitialBuildProjects.Identity).csproj" />
            <RemainingSourceProjects        Include="$(ProjectRootDirPath)\Sources\**\*.csproj"
                                            Exclude="@(PriorityProjects)" />
            <SLTestProjects                 Include="$(ProjectRootDirPath)\Tests\*.Web\*.Web.csproj" />
            <BuildQueue             Include="@(PriorityProjects);@(RemainingSourceProjects);@(SLTestProjects)" />
        </ItemGroup>
    

    Works for us in private builds + on our TeamCity server.

    Does this help ?

    0 讨论(0)
  • 2020-12-31 22:22

    This definitely doesn't seem to be the "proper" solution, but as an interim option what about checking in the generated Generated_Code\*.g.cs files for your RIA services present in your Silverlight projects? If people check in the up-to-date version along with the matching updates to their DomainService classes, all should build as expected.

    0 讨论(0)
提交回复
热议问题