BuildActivity忽略ToolsVersion [英] BuildActivity ignores ToolsVersion

查看:64
本文介绍了BuildActivity忽略ToolsVersion的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在BuildAgent上运行的持续集成版本,但无法正常工作.我最近将代码库更改为C#6.0,并将项目更改为ToolsVersion 14.

I have a Continuous Integration Build Running on a BuildAgent which I can not get working properly. I recently changed our codebase to C# 6.0 and changed the projects to ToolsVersion 14.

我确实在Build Server(TFS 2012)上安装了Visual Studio 2015.如果现在我检查C#6.0代码,则在第一个项目上构建失败("$"是意外的或类似的东西)

I did install Visual Studio 2015 on the Build Server (TFS 2012). If I do now check in the C# 6.0 code the build fails on the first project ("$" is unexpected or something")

BuildTemplate是"DefaultTemplate.11.1" 如果我检查日志文件,则生成的版本会调用错误的csc.exe(C:\ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ Csc.exe)

The BuildTemplate is "DefaultTemplate.11.1" If I check the log files the build calls the wrong csc.exe (C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Csc.exe)

如果我确实使用该项目启动了MSBuild/14.0/Bin/MSBuild可执行文件,而没有进行任何切换,则构建成功.为什么TFS BuildAgent不使用ToolsVersion,如何获得TFS 2012来构建Visual Studio 2015解决方案

if I do start the MSBuild/14.0/Bin/MSBuild executable with the project without any switches the Build succeeds. Why does the TFS BuildAgent not use the ToolsVersion and how can I get TFS 2012 to build my Visual Studio 2015 solution

如果我添加MSBuildArgument/tv:14.0,它仍然会失败.它称为Visual Studio 2015附带的.Build NET 4.6 RC框架MSBuild的第12版.

If I add the MSBuildArgument /tv:14.0 it still fails. As it calls th Version 12 of MSBuild which is part of the .NET 4.6 RC Framework which ships with Visual Studio 2015.

更改MSBuild活动的ToolsPath确实可以使Build正常工作,但是如果尝试运行UnitTest会吐出一些问题.我收到一个缺少dll的"Microsoft.VisualStudio.TestPlatform.Utilities.dll"异常. (在构建服务器上也安装了VS2012).

Changing the ToolsPath of the MSBuild Activity does get the Build working but spits bullets if I try to run my UnitTest. I get aMissing dlls "Microsoft.VisualStudio.TestPlatform.Utilities.dll" exception. (VS2012 is installed as well on the Build Server).

更新: 我的单元测试确实出现了另一个错误:

UPDATE: I do now get a different error with my unit tests:

TF900548: An error occurred publishing the Visual Studio test results.
Details: 'Method not found:
'System.Collections.Generic.IEnumerable<System.String>
Microsoft.VisualStudio.TestPlatform.Utilities.InferSettingsHelper.MergeRunSettingsAndFindCompatibleSources(Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture
ByRef,
 Microsoft.VisualStudio.TestPlatform.ObjectModel.FrameworkVersion
 ByRef, System.String, System.String,
 System.Collections.Generic.IDictionary`2<System.String,System.Collections.Generic.KeyValuePair`2<Microsoft.VisualStudio.TestPlatform.ObjectModel.Architecture,Microsoft.VisualStudio.TestPlatform.ObjectModel.FrameworkVersion>>,
 System.Xml.XPath.IXPathNavigable, System.String ByRef)'.'

推荐答案

对于那些每天都不住在构建模板中的人来说,以下是使它对我有用的步骤:

For those of us not living inside build templates every day here's the steps that got it working for me:

首先找到与您的构建相关的模板(如果您已经知道在哪里可以找到,请跳过几个步骤).

First find the template associated with your build (if you already know where to find it skip a couple steps).

  • 只需右键单击构建定义,然后选择Edit build definition

选择Process选项卡,您将看到模板的名称(如果尚未自定义,则很可能是DefaultTemplate).在最右侧,单击Show details以查看模板的路径.

Select the Process tab and you'll see the name of the template (quite likely to be DefaultTemplate if you haven't customized it). On the far right click Show details to see the path for the template.

  • 转到团队资源管理器"下的"Home"选项卡,然后单击"Source control explorer
  • ".
  • Go to the Home tab under Team explorer and click Source control explorer

  • 找到模板文件,然后双击以对其进行编辑.它应该以这样的图形视图显示.滚动直到找到Run MSBuild for Project

  • 单击此项目将立即显示属性

  • 单击右侧的小图标-不要尝试键入它,因为它可能会爆炸并导致Visual Studio崩溃.

  • Click on the little icon on the right - don't try and type it in because it'll probably explode and crash Visual Studio.

输入以下"C:\Program Files (x86)\MSBuild\14.0\bin"

对我来说Run MSBuild for Project在两个地方.

所以我只是在两个地方都重复了上述步骤,然后签入.xaml文件后,我的构建最终运行正常.

So I just repeated the above steps in both places, and then after I checked in the .xaml file my build FINALLY worked fine.

您可能需要从TFS工具中回收代理/控制器.

You may need to recycle the agent / controller from within the TFS tool.

这篇关于BuildActivity忽略ToolsVersion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆