TFS 2017 doesn't build Fakes targets

2019-05-17 08:49发布

问题:

I have a TFS 2017 Update 2 on-prem server with VS 2017 Enterprise installed. Our Build contains a Unit-Testing project which contains a Fakes assembly and works locally on the dev machines. When build on TFS, the build fails with

The type or namespace name 'Fakes' does not exist in the namespace 'Our.Product' (are you missing an assembly reference?)

(i.e. misses/fails to generate the Our.Product.Assembly.Fakes.dll file)

I have additionally set up Fakes as suggested here.

What baffles me is that there are no mentions of Fakes in the build log (except for the error itself and the paths where MSBuild looks for the file), even with debug verbosity. He doesn't event try to generate the Fakes assembly.

Are there other steps I need to take? We use the vNext build definitions.

Update: This is the build step that works now, before the /tv:15.0 /p:VisualStudioVersion=15.0 were not there.

回答1:

Update

Use the latest version for msbuild arguments such as /tv:15.0 /p:VisualStudioVersion=15.0 could solve this issue.


First try to use build service account RDP to remote build agent and manually run the build to see if the assembly generated.

This will narrow down if it's related to your environment on the build agent. Make sure it's the same as your locally dev machines.

If the assembly is also generated, then the issue may related to your build definition settings. Check if you are using the right msbuild version. For vNext build, also enable verbose Debug Mode with system.debug=true