Silverlight 4、RIA 服务和TFS 2010 构建服务器

发布于 2024-10-24 03:14:24 字数 320 浏览 5 评论 0原文

我有一个 Visual Studio 2010 解决方案文件,其中包含许多项目。混合了 Silverlight 项目(充当模块)、Silverlight Shell 项目和许多 RIA 服务。

当使用TFS 2010执行构建时,总是失败,因为RIA服务生成的代理类尚未首先构建。到目前为止,我看到的唯一解决方案是手动更改 .sln 文件中的构建顺序。不,谢谢,有很多项目。

我不想将解决方案分解为客户端和服务器端解决方案,而是想找到更好的解决方案。

显然 MSBuild 4 忽略 .sln 文件中的构建顺序。

有人有什么想法/建议吗?

谢谢你,

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 number of RIA services.

When using TFS 2010 to perform the build, it always fails because the proxy classes generated by the RIA services have not been built first. The only solution I have seen so far is to manually change the build order in my .sln file. No thanks, there are loads of projects.

Rather than break the solution up in to client side and server side solution, I'd like to find a better solution.

Apparently MSBuild 4 ignores the build order in the .sln file.

Does anyone have any ideas/suggestions?

Thank you,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

你列表最软的妹 2024-10-31 03:14:24

我发现的最简单的方法是显式声明 Silverlight 项目和托管 RIA 服务的项目之间的依赖关系。

您必须在文本编辑器中打开 Silverlight 项目文件并向其中添加一个片段:

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

这将告诉 msbuild 在构建 Silverlight 应用程序之前构建您的 Web 服务。而且只有在使用 msbuild 构建时才有效,VS 会抛出错误。

要在 Visual Studio 中也构建它,您必须将此片段包装在 Target 中并将其添加到 Project 节点中的 InitialTargets:

<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 现在将跳过此目标,但 msbuild 将用于更改项目的构建顺序。

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.

匿名。 2024-10-31 03:14:24

这似乎绝对不是“正确”的解决方案,但作为临时选项,检查为 Silverlight 项目中存在的 RIA 服务生成的 Geneerated_Code\*.g.cs 文件怎么样?如果人们签入最新版本及其 DomainService 类的匹配更新,那么所有内容都应该按预期构建。

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.

半衬遮猫 2024-10-31 03:14:24

下面是我们在项目中使用的 MS Build 脚本的示例。基本上,我们已将 Web 项目(包含 RIA 服务)标记为优先项目,并首先构建它。

请注意,第一个 XML 标签应位于环境设置阶段的某个位置。

<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>

在我们的 TeamCity 服务器上的私人构建 + 上为我们工作。

这有帮助吗?

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 ?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文