2
votes

How do I get my build server to use the correct version of MSBuild?

I have a Windows 8.1 Windows Store app that I need to build on a build server running TFS 2012. The build server has Windows 8.1 and Visual Studio 2013 installed.

According to the instructions on http://msdn.microsoft.com/en-us/library/vstudio/dd647548.aspx#older_process_template I have to "set the MSBuild ToolPath property to the path to the path to MSBuild 12."

In my build definition under Process, Advanced I have set MSBuild Arguments to: /p:VisualStudioVersion=12.0;ToolPath="C:\Program Files (x86)\MSBuild\12.0\Bin\amd64"

However, the setting doesn't seem to take effect, as I get the following error when building:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\AppxPackage\Microsoft.AppXPackage.Targets (1224): Task 'GenerateAppxPackageRecipe' failed. Value cannot be null. Parameter name: source

If I check the build log I can see it is still using the wrong MSBuild,i.e. C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe

1

1 Answers

4
votes

I found the solution: Edit the build process template in Visual Studio, in my case this was DefaultTemplate.11.1.xaml. Find the "Run MSBuild for Project" activity and change the ToolPath to:

"C:\Program Files (x86)\MSBuild\12.0\Bin\amd64"

Don't forget to include the quotes.

Repeat this for all other "Run MSBuild for Project" activities, I had two to change.