14

I am running TFS 2015 and are using the Visual Studio Build Step. On the developemnt machines I moved to use Visual Studio 2017 so I also want to use Visual Studio 2017 for the TFS builds.

I installed Visual Studio 2017 on the build server and restarted the build agent. However Visual Studio 2017 does not show up in the capabilities of the agent and it also does not show in the list of Visual Studio versions in the build step.

I know I can choose "latest" from the list of Visual Studio version in the build step, but this will still use VS 2015 as the agent does not know that it has VS 2017.

How can I make sure that the Visual Studio Build Step in TFS2015 uses Visual Studio 2017?

Marco
  • 430
  • 4
  • 9

2 Answers2

16

You can use MSBuild task instead of Visual Studio Build Step, then specify the location of MSBuild 15.0:

enter image description here

Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39
  • This is exactly what I ended up doing. The only issue I had was that in our environment we have multiple build servers and for a test I installed MSBuild at only one. So at first it failed because TFS picked one of the others. So when having multiple servers you must make sure that MSBuild is at the same location on all of them. Which, of course, normally should be as the servers should be configured the same way. – Marco Mar 10 '17 at 15:56
  • 1
    I tried this suggestion, but the task still appears to 'auto-detect' which version to use. For some reason it disregards the path of the folder I specify that contains the exe. Do I need to perform an update on the machine (i.e. change an environment variable)? – Brian Sep 11 '17 at 17:49
  • @Brian did you find any way to fix it? I'm having the same issue with auto-detection. – Alvaro Rivoir Oct 12 '17 at 13:51
  • @Alvaro I was not able to fix it, but I believe moving to 2017 would resolve the issue. – Brian Nov 16 '17 at 17:40
  • 2
    @Brian I found the MSBuild version auto detection override only happened when the "Restore NuGet Packages" option was checked. When I unchecked that option (which is deprecated according to [the docs](https://learn.microsoft.com/en-us/vsts/build-release/tasks/build/msbuild)) it correctly used the MSBuild.exe from the "Path to MSBuild" option. If you still need the MSBuild task to restore the NuGet packages a `/restore` command line argument was recently [added as of MSBuild 15.5.90](https://github.com/Microsoft/msbuild/pull/2414). – Sean Rose Mar 07 '18 at 17:25
2

In TFS 2015 the build steps and forward compatibility is only updated when TFS is updated. If you are using TFS 2015.3 already then you will need to move to TFS 2017 to use this out of the box.

The build step ultimately calls out to devenv.exe and the drop down changes the path. You can call out manually to VS 2017...