0
votes

I recently installed TFS 2017 Express on my Windows 10 Pro PC. I also have Visual Studio 2017 Pro installed on the same machine. When trying to build a solution on TFS, I noticed a persistent behavior. If my solution includes a unit test project, the build process fails at the "Visual Studio Build" step. If I remove the unit test project, commit to TFS, and queue a new build, the build succeeds.

I made sure to indicate "Visual Studio 2017" in the Nuget and Visual Studio build steps and "latest" in the Test build step.

These are the relevant excerpts from the log:

  • (Warning) Visual Studio version '15.0' not found. Looking for the latest version.
  • (Error) HelloConsole\packages\Microsoft.Net.Compilers.2.1.0\build\Microsoft.Net.Compilers.props (13, 5) HelloConsole\packages\Microsoft.Net.Compilers.2.1.0\build\Microsoft.Net.Compilers.props(13,5): Error : Microsoft.Net.Compilers is only supported on MSBuild v14.0 and above
  • (Error) Process 'msbuild.exe' exited with code '1'.

I would include any other logs or screenshots if that would help diagnose the issue.

This symptom only happens when a C# unit test project is present. Are there any workarounds so that I can run TFS builds with a C# unit test project in the solution?

I did look at the available documentation and see nothing helpful in this scenario. I drilled through that document and looked into MSBuild Command-Line Reference, thinking I could direct Visual Studio Build to use MSBuild version 15. All I found under "version" was /version: Display version information only. The project isn’t built.

Update: I see that there are two different ways to download TFS Express. The way I downloaded it had no mention of version. I downloaded it from here and scrolled to "Team Foundation Server Express" and clicked "Download". There was no mention of a version, as indicated by @PatrickLu-MSFT.

1
There's only one version of express available on the official download site. No version is mentioned.RandomHandle
Hi @RandomHandle, have you tried directly use msbuild command line on the build agent to see if it's also build successfully locally on the build agent which include the unit test project. This will narrow down if the issue related to your build agent environment. And instead of directly build the entirely solution, you could also try to directly build MSBuild project (.*proj) files (Unit test project). What's the result for this situation?PatrickLu-MSFT

1 Answers

1
votes

According to the error message logged above:

Microsoft.Net.Compilers is only supported on MSBuild v14.0 and above

TFS build are using the msbuild version distributed with .NET Framework, which is an old version. You could manually check if there are the path to the version distributed with VS 2017 / Build Tools for VS 2017 on the build agent which should be like

xxx\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe

Then directly use this MSBuild.exe run the solution with unit test project on the build agent. This will narrow down if the issue related to build agent environment or not.

Suggest you to enable verbose debug mode to get more detail log for troubleshooting.

You could also upgrade your TFS Express to latest version Team Foundation Server Express 2017 Update 3, and for the build task such as Visual Studio Build, make sure you have selected the latest task version(on left corner of the configuration page).