11

We have a build definition in TFS 2015 that have worked fine with Visual Studio 2015 projects and solutions. We have now decided to upgrade to Visual Studio 2017 and thus we would like to target Visual Studio 2017 in the Visual Studio build task. We have installed Visual Studio 2017 on the build agent. Unfortunately the only options available int the Visual Studio build task are 2012, 2013, 2015 and Latest. We have tried latest but it does not find Visual Studio 2017 on the build agent. It won't work with the msbuild task either.

Quattordici
  • 111
  • 1
  • 6
  • "have decided" "installed [...] on the build agent" Please tell us, that this is not what it looks like... Things like that should not be tested on the production environment... – swe Mar 09 '17 at 13:35
  • 5
    Who have even mentioned a production environment? I dont understand your point at all. – Quattordici Mar 10 '17 at 07:56
  • Related post - [How can I install the VS2017 version of msbuild on a build server without installing the IDE?](https://stackoverflow.com/q/42696948/465053) – RBT Mar 04 '20 at 11:48

5 Answers5

12

I have a similiar issue and resolved by installing VS2017 in my build agent server and configuring MSBuild to point to my MSBuild 15.0 folder:

  1. Add MSBuild to your build steps
  2. On the Advanced options, expand and fill the 'Path to MSBuild' like the image below:

    C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin
    

    enter image description here

androzo
  • 131
  • 1
  • 5
  • This is the only solution that works. Sometimes adding a `/tv:15.0` to the msbuild args is necessary – StingyJack Dec 14 '17 at 18:20
  • I have had similar issues and using this method solved my problem of building C#7 code by pointing my TFS2015 build at the VS2017 msbuild path, the only thing I want to mention is that the path should not contain any quote characters. I was using the quoted path and the build was not working for me, but once the quotes were removed all was building fine - a small thing to mention but it was tripping me up for a while! – Vermin Apr 19 '18 at 07:21
  • These details are really important so we don't spend time. Thanks for the feedback Vermin! Just edited the answer. – androzo Apr 20 '18 at 11:38
  • How do you bring up that window? We have been using TFS for years to come and full MS subscription. Half the pointers in here I see no where. ToolPath? MsBuild Tool Path? Where? How? What version of TFS/VS2019 are you using? I'm so sick of this version problem with MS – Christian Jul 03 '20 at 12:09
2

VS2017 RTM is released recently while TFS2015 was released before. That's why there is no VS2017 option in VS Build Task in TFS2015 Server. If you upgrade your server to the latest TFS2017, you would see "Visual Studio "15" (preview)" option listed in VS Build Task which is the version for VS2017 preview. And in the feature, the option will be updated to VS2017 which is the same as VSTS.

Eddie Chen - MSFT
  • 29,708
  • 2
  • 46
  • 60
  • thanks for the details. To verify if we have corporate TFS 2015 server and there is no plan on upgrading it to 2017 roadmapped then we cannot use any of the new language features in C# 7 as VS2017 will not be recognized. – Tedford Mar 17 '17 at 18:10
  • @Eddie - MSFT please point to official statement where VS2017 cannot be used with TFS 2015 Update 3. – StingyJack May 04 '17 at 14:06
  • @Eddie-MSFT: I also came across this issue, my TFS 2017 still doesn't show Visual Studio 2017 in VS Version drop down in VS Build task. Is it possible to update this manually? If so, please let me know the steps. – Bandara Aug 29 '17 at 13:08
2

we are facing a similar issue and it is not possible for us to update ourselves as it is maintained on a company level where we cannot take that much influence. However our team wanted to switch to VS2017 and make use of the C# 7 features. That's why we tried it as well with replacing the build steps from Visual Studio Build to MSBuild. Sadly this did not work as expected (we got some errors during the build).

As our main objective is to use the C# 7 features we looked for a way how to still achieve that at the time with Visual Studio 2015 remaining on the Build Server. We ended up using the nuget package Microsoft.Net.Compilers that, when used in a project, will use that compiler instead of the installed one. More on this can be found in this Thread.

huserben
  • 1,034
  • 1
  • 10
  • 19
1

It seems the updates to the build tools are installed via the command line of the VS2017 installer.

See the docs for details.

Richard
  • 106,783
  • 21
  • 203
  • 265
  • I have no problem with the build tools on the build agent. The problem is that the builtin build tasks in tfs does not know how to find the 2017 build tools. For now it seems that we will have to got the command line way. – Quattordici Mar 10 '17 at 08:00
  • @Quattordici, How about use MSBuild task instead of Visual Studio Build Step, then specify the location of MSBuild 15.0? – Cece Dong - MSFT Mar 10 '17 at 09:50
  • @Cece-MSFT That was also my first idea. It did not work as it would not find the specified path. And thus fallbacking to old msbuild. Very strange! I assume it is looking for the path on the build agent. – Quattordici Mar 10 '17 at 10:21
  • All tools should be installed on build agent machine. If you specify the the location of MSBuild 15.0 on your build agent machine in MSBuild task, what error will you get? – Cece Dong - MSFT Mar 13 '17 at 08:55
0

Just adding another thing: if you're using custom build template make sure to edit it and modify the ToolPath attribute value to:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin

MOses
  • 71
  • 9
  • I give up. What tool path? I just downloaded the default template. there is no ToolPath. No MS tool path either... What versions are you guys using? – Christian Jul 03 '20 at 12:10