我们有TFS构建机器配置为从TFS构建源代码。在这台机器上,我们安装了Team Foundation Server 2013和Microsoft Build Tools 2013,然后最近我们安装了Microsoft Build Tools 2015.在构建定义中,我们将/tv:14.0用于MSBuild参数以表明我们要使用版本14.0 MSBuild的。此外,我们将执行代码分析设置为false,以便它不会执行代码分析。 但是,当我们对构建进行排队时,它会因给定错误而失败:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\CodeAnalysis\Microsoft.CodeAnalysis.targets (214): The source file for this compilation can be found at: "C:\Users\tfsservice\AppData\Local\Temp\b54ca1bb-e696-4214-a196-5c79c32345cd.txt"
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\CodeAnalysis\Microsoft.CodeAnalysis.targets (214): An error has occurred during compilation. error CS1705: Assembly 'Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' uses 'Microsoft.Build.Framework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'Microsoft.Build.Framework, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\CodeAnalysis\Microsoft.CodeAnalysis.targets (214): The "SetEnvironmentVariable" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Program Files (x86)\MSBuild\14.0\bin\amd64" directory.
以前有人遇到过这个问题吗? 看起来Microsoft.Build.Utilities.Core被引用到了错误版本的Microsoft.Build.Framework。
但是,在MSBuild.exe.config中,此程序集将重定向到corectlly
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="14.0.0.0"/>
</dependentAssembly>
感谢任何帮助。
P.S。我们想要构建的解决方案是从VS 2013升级到VS 2015的可视化c ++解决方案。
答案 0 :(得分:3)
似乎许多其他社区成员都有类似的问题, /tv:14.0 参数不起作用。请查看此link以获取详细信息。
解决方法是:而不是使用 /tv:14.0 参数,您需要自定义tfs构建过程模板以将运行MSBuild for Project 的ToolPath设置为目标到MSBuild14;并将ToolVersion设置为“14.0”。