RandomHandle
RandomHandle

Reputation: 651

TFS 2017 Express fails build if unit test project is included in solution

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:

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.

Upvotes: 0

Views: 386

Answers (1)

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51103

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).

Upvotes: 1

Related Questions