visual-studio - 使用相同的 TFS 构建定义构建解决方案和项目

标签 visual-studio tfs msbuild tfsbuild

我正在尝试拥有一个包含解决方案文件和项目文件的 TFS 2012 构建定义。

构建运行时,不会构建解决方案。相反,我收到如下警告:

F:\Source\1\MyCode\src\MySolution.sln.metaproj: The specified solution configuration "Release|AnyCPU" is invalid. Please specify a valid solution configuration using the Configuration and Platform properties (e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave those properties blank to use the default solution configuration.

这是由一个错误引起的,该错误导致 Visual Studio 使用“AnyCPU”作为解决方案文件的平台,而它使用“AnyCPU”作为项目文件。看: http://connect.microsoft.com/VisualStudio/feedback/details/503935/msbuild-inconsistent-platform-for-any-cpu-between-solution-and-project

有没有一种方法可以配置我的构建以使其在存在问题的情况下仍能正常工作?即,一种将特定平台值传递给特定 sln 构建命令同时将不同值传递给其他命令的方法?

最佳答案

如何编辑您单独构建的 .csproj 并将 Or '$(Platform)' == 'Any CPU' 添加到 Platform 属性的默认条件覆盖/修剪空间?

<PropertyGroup>
  <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
  <Platform Condition=" '$(Platform)' == '' Or '$(Platform)' == 'Any CPU' ">AnyCPU</Platform>

关于visual-studio - 使用相同的 TFS 构建定义构建解决方案和项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24335646/

相关文章:

rest - 使用 REST API 获取 TFS 工作项及其链接

.net - 通过CMD运行 SandcaSTLe 帮助文件生成器时,$(SolutionDir)MSBuild属性不正确

sql-server - SSDT 创建回滚部署脚本?

tfs - 在 VSTS 中,是否可以将功能/用户故事/任务分配给团队 [组]

c# - 创建对特定 RID 的另一个项目的 NET Core 项目引用

TFS MSBuild 复制命令

.net - 使字符串在 .NET 应用程序中持久化

visual-studio - Visual Studio 用户指南在哪里

c++ - 在 VS Express 中添加文件

c++ - 调用 RPC 调用时为 "Already listening"