4

After upgrade of Visual Studio 2017 last week on my build server, the MS Build 15.0 is not in use anymore. So whenever I try to compile visual studio 2017 projects which use new feature they will fail.

The Warning in build log is:

Visual Studio version '15.0' not found. Looking for the latest version.

And the error is:

something.cs(542,41): Error CS1525: Invalid expression term 'int'

Which is because build server is using MS build 14.0 I guess.

So far I have 1- Uninstall and Reinstalled the Visual Studio 2017 on the build server. 2- Installed "Visual Studio Build Tools 2017".

And nothing works. I have read some articles and apparently there are missing registry values but I don't know how to create them.

Appreciate your helps on this topic.

I am using TFS 2017 SP1 (On premises) and Visual Studio 2017 latest updates.

Barsham
  • 749
  • 8
  • 30

2 Answers2

4

This may due to the VS is installed after the build agent configured. Then reregister the build agent with TFS, since the system capabilities are only discovered when the agent is first configured -- any changes made after that are not captured.

More ways please refer this similar question: No agent could be found with the following capabilities: msbuild, visualstudio, vstest?

Or install the latest version of the agent for now, which appears to be capable of detecting VS2017.

Also remember to select VS2017 in Visual Studio Version picklist of Visual Studio Build task.

enter image description here

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • The agent should re-discover capabilities on every startup, so restarting the agent should work as well.. – Martin Ullrich Sep 04 '17 at 08:39
  • Nope. Created a total new agent, disabled all other ones. and the error is same. Also this is the version of my agent vsts-agent-win7-x64-2.112.0.zip – Barsham Sep 04 '17 at 10:01
  • 1
    Nope. Got the latest version too but it didn't resolved the issue. Still telling me "Visual Studio version '15.0' not found. Looking for the latest version." – Barsham Sep 04 '17 at 10:07
  • @Barsham Could you manually run the build on the build agent server with VS. This will narrow if the issue is related to your build agent environment or TFS server side. – PatrickLu-MSFT Sep 04 '17 at 10:12
  • Yes, even if I use MSBuild component and specify the location manually it works. But I cannot change all over 300 builds on my server with this method. – Barsham Sep 04 '17 at 10:42
  • Another interesting fact is that under the agent capabilities, I can see correct path for VS 2017 ! MSBuild_15.0 and MSBuild_15.0_x64 – Barsham Sep 04 '17 at 10:47
  • @Barsham Did you select VS2017 in Visual Studio Version picklist of Visual Studio Build task as the above screenshot. And also give a try add `/p:VisualStudioVersion=15.0` in your msbuild argument, trigger the build again. – PatrickLu-MSFT Sep 04 '17 at 12:20
  • @Patrick-MSFT thanks for your help. The issue has been resolved by installing TFS 2017 SP2, – Barsham Sep 04 '17 at 12:52
3

I have resolved this issue by upgrading my TFS from TFS 2017 SP1 to TFS 2017 SP2.

Thanks to @Patrick-MSFT and @Martin Ullrich for your help.

Barsham
  • 749
  • 8
  • 30