TFS 2017 - Build Server does not build Visual Stud

2019-05-12 01:12发布

问题:

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.

回答1:

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.



回答2:

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.