更新构建控制器/代理以构建 C# 6/.NET 4.6 应用程序 [英] Update Build Controller/Agents to build C# 6 /.NET 4.6 application

查看:21
本文介绍了更新构建控制器/代理以构建 C# 6/.NET 4.6 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

场景如下:

我们在我们的公司网络中使用 Visual Studio Online 和内部部署构建服务器以及 TFS 2013,在门控签入和发布后构建我们的解决方案.

We use Visual Studio Online and an on-premise build server in our company network with TFS 2013 to build our solution after gated check-ins and releases.

现在我们从 Visual Studio 2013 升级到 Visual Studio 2015 Enterprise 并升级到新的 .NET 版本.我们真的很想利用 C# 6 的新功能,但在第一次签入后,我们遇到构建失败.

Now we upgraded from Visual Studio 2013 to Visual Studio 2015 Enterprise and upgraded to the new .NET version. We are were really eager to make use of the new features of C# 6 but after the first check-in we experienced that the build failed.

(抱歉这里没有图片,因为我缺乏声誉)

(Sorry no image here as I have a lack of reputation)

异常消息:MSBuild 错误 1 ​​已结束此构建.你可以找到有关上述错误原因的更多具体信息消息.(类型 BuildProcessTerminateException)异常堆栈跟踪:在 System.Activities.Statements.Throw.Execute(CodeActivityContext上下文)在System.Activity.CodeActivity.InternalExecute(ActivityInstance)实例、ActivityExecutor 执行器、BookmarkManager bookmarkManager)在System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutorexecutor, BookmarkManager bookmarkManager, Location resultLocation)ApplicationManager.cs (33, 0) 意外字符 '$'ApplicationManager.cs (33, 0) ;预期

Exception Message: MSBuild error 1 has ended this build. You can find more specific information about the cause of this error in above messages. (type BuildProcessTerminateException) Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation) ApplicationManager.cs (33, 0) Unexpected character '$' ApplicationManager.cs (33, 0) ; expected

似乎构建代理不理解新语法,仍然使用旧版本进行编译.

It seems that the build agent does not understand the new syntax and still compiles with old version.

我为修复它所做的是:

  • 在本地构建服务器上安装 Visual Studio 2015(仍安装旧版本的 Visual Studio 2013)

  • Install Visual Studio 2015 on the on-premise build server (the older version Visual Studio 2013 is still installed)

重新启动构建控制器

按照此处的步骤操作:https://stackoverflow.com/a/28327275/4919063

主要是安装 Visual Studio 2015 和新的 Microsoft Build Tools

Which is basically installing Visual Studio 2015 and the new Microsoft Build Tools

  • And the steps in here which were very promising:

我使用其中一个模板创建了一个新的构建定义

I created a new build definition with one of the templates

通过 Web 访问为 Visual Studio Online 创建了一个新的代理池.已下载

Created a new agent pool via the web access for Visual Studio Online. Downloaded

ConfigureAgent.ps1 并在构建服务器上执行以创建新的

the ConfigureAgent.ps1 and executed it on the build server to create a new

代理.但是我不知道如何使用新创建的代理.

agent. But I couldn't figure out how to make use of the newly created agent.

我的问题是:如何更新构建代理以使其在

My question is: How can I update the build agents to run without failure in

尊重新的 .NET 版本?

respect to the new .NET version?

推荐答案

我怀疑您仍在运行 2013 Build 代理?在这种情况下,打开您的构建过程模板并查找为项目运行 Msbuild"任务.将 ToolPath 属性设置为位置您的 v14 MsBuild 的安装位置.默认值:

I suspect that you're running the 2013 Build agent still? In that case, open your build process template and look up the "Run Msbuild for project" task. Set the ToolPath property to the location where your v14 MsBuild is installed. Default:

C:Program Files (x86)MSBuild14.0Bin

这应该允许您使用 C# 6 语法元素.

That should allow you to use the C# 6 syntax elements.

通过删除 Roslyn nuget 包来删除本文中的步骤,现在不再需要 NuGet 包了,因为 VisualStudio 2015 是 RTM.VS2013 不再支持相同的包.

Remove the steps from this post by removing the Roslyn nuget packages, the NuGet package is no longer needed now that Visual Studio 2015 is RTM. The same package is no longer supported for VS2013.

您下载的新 TFS 2015 构建代理不会与 TFS 2013 通信,TFS 2015 XAML 构建代理也不会.只要您的服务器运行的是 TFS 2013,您就会一直使用 TFS Build 2010,直到 2013 年(包括 2013 年).

The new TFS 2015 build agent you downloaded doesn't talk to TFS 2013, neither does a TFS 2015 XAML build agent. As long as your server is running TFS 2013, you're stuck using TFS Build 2010 up to and including 2013.

当连接到 VSO 时,您应该能够使用新的 2015 构建代理.但是您需要使用 Web 界面创建一个新的构建定义.您不能将现有的 XAML 构建定义与新的构建代理一起使用.

When connecting to VSO you should be able to use the new 2015 build agent. But you need to create a new build definition using the Web interface. You cannot use your exuiting XAML build definition with the new build agent.

您还可以安装 TFS 2015 XAML 代理.要安装它在构建服务器上安装 TFS 2015 并仅运行配置 XAML 构建代理的步骤.这将从您的计算机中删除 TFS 2013 构建服务器.

You can also install the TFS 2015 XAML agent. To install it install TFS 2015 on the build server and only run the steps to configure the XAML build agent. This will remove the TFS 2013 build server from your machine.

这篇关于更新构建控制器/代理以构建 C# 6/.NET 4.6 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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