6
votes

We have an on-premise TFS 2012 server and build server. We are in the process of upgrading to VS and TFS 2017. At the moment, there is the request to set up another build server that will allow us to build new 2017 projects from the existing TFS server. I create a new build server and installed TFS 2012 build services on it as well as VS2017. I created a new build definition but it fails to compile and errors show things like the syntax changes for 2017 that are invalid in 2012. How do I tell configure this to build the project against the installed VS2017?

2
We are using the DefaultTemplate11.1xaml. I've read that there are new versions that will get the MSBuild version from the new path, but I don't know where to get these new templates from.Sam
The build templates are completely different in TFS2017. You might want to weigh up how long it might take to resolve this. It will be easier to upgrade. I have recently done it and because you're on 2012 you'll have to upgrade to 2013 or like I did 2015 before 2017. I had to slightly modify the process templates too.Jeremy Thompson
So TFS 2012 can't go directly to 2017? We weren't aware of that. Do you know why? I saw a few places that said the DefaultTemplate.11.xaml could be modified to point to the new MSBuild version, but the section mentioned doesn't seem to exist in my files.Sam
I had to edit Process templates XML files. It's easier to recreate the build definition using tfs2017Jeremy Thompson

2 Answers

9
votes

Thanks to this post, I was able to use TFS 2012 continuous integration with build server building C# 6 syntax using Visual studio 2017. Hopefully this will save the next person some time in trying to figure this out.

Here are the list of things I have changed in order to get TFS 2012 to build c# 6 syntax. On the machine with the build agent, install vs 2017 enterprise, on the installation setup page, make sure MS build is selected enter image description here

Edit the Build definition and make sure the MSBuild Argument is /tv:15.0 /p:GenerateBuildInfoConfigFile=false /p:VisualStudioVersion=15.0

enter image description here

Check the template your build definition is using and modify it by going to the source control explorer and going into the team project and undert BuildProcessTemplate, it should have the .xaml file, modify it by double clicking on itenter image description here

There should be 2 actions that say Run MSBuild for Project. You need to change both of their toolpath property to point to the msbuild.exe parent folder on the build server. In my case, the build server is a 32 bit machine so the path to the Bin folder doesn't have (x86) next to Program Files, you need to check your build server to enter the correct path here. enter image description here After you have made the changes, you need to save the xaml and check it in.

2
votes

Old Visual Studio versions installed msbuild into C:\Program Files (x86)\MSBuild\<version>\bin and apparently the RunMSBuild activity used the ToolVersion + the ToolArchitecture to calculate this path.

VS 2017 instead installs it C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin and the RunMSBuild can't calculate the proper path anymore. You can not use the old DefaultTemplate11.1xaml to integrate with VS2017.

To make this work, you could try to modify the TFSBuildServiceHost.exe.config and you must have a version of VS 2013 or VS 2015 installed on the build server in order for this to work. More detail step please follow Jonesy2488's answer in this link:How to get VS 2017 working with TFS 2017 XAML Builds


Moreover, XAML Build are deprecated in TFS 2017 and will not be available in tge next version of TFS(2018). VSTS already no longer supports them.

I'm looking for the hosted XAML build controller. Where did it go?

The hosted XAML build controller is no longer supported. Accounts created on or after April 2016 do not have access to it. We plan to remove the hosted XAML build controller from all accounts, possibly as soon as March 2017.

Source

Since you are going to upgrade and use TFS2017. Highly recommend you to convert your builds to vNext Build to access some new technology and support. For more please refer Why Should I Leave XAML Builds?