Update Build Controller/Agents to build C# 6 /.NET 4.6 application

ぐ巨炮叔叔 提交于 2019-12-18 03:57:09

问题


here's the scene:

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.

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)

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.

What I did in order to fix it was:

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

  • Restarted the build controller

  • Followed the steps in here: https://stackoverflow.com/a/28327275/4919063

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

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

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

respect to the new .NET version?


回答1:


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)\MSBuild\14.0\Bin

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

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.

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.

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.

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.




回答2:


I can't set the toolPath Property because "Run Msbuild for project" is replaced by a more abstract "Run MSBuild"-Activity in my used "TfvcTemplate.12.xaml". I think it came with TFS 2013 Update 4.

I installed VS 2015 on the BuildMachine.

And i changed the builds by adding the /tv:14.0 Parameter as MSBuild argument (in Build-Definition\Process\2.Build\5.Advanced\MSBuild arguments)

This worked for me. See answer from marson



来源:https://stackoverflow.com/questions/31654804/update-build-controller-agents-to-build-c-sharp-6-net-4-6-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!