MSBuild 15 - Type or namespace "Fakes" does not exist in namespace

I am trying to configure automatic assemblies and unit tests for a project that uses the Fakes library for its unit tests. The project builds and tests on my Windows 10 PC (VS 2017 Enterprise is installed), however, using the same command to compile the project on the build server (also Windows 10 with VS 2017 Enterprise), you get several errors that Fakes does not exist . Exact errors look like this:

XControllerTests.cs(10,20): error CS0234: The type or namespace 'Fakes' does not exist in the namespace 'System.Data.Common' (are you missing an assembly reference?) [C:\Runner\builds\xxx\XTests.csproj]

From my research, this was caused by using the old version of MSBuild, however I checked the server and confirmed that it had the latest version and updates for the visual studio. I also confirmed that the build script uses the correct version of MSBuild.exe, which is c:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe. Using this version on my desktop compiles the project correctly.

Why does the assembly not work on the build server with the same configuration?

+6
source share
2 answers

To extend @McMlok's answer above, I will include what I did.

  • Source: my local driver VS2017 Premium Update 1 dev.
  • Target: VS2017 Build Tools VM.

Copy the Fakes folder :

  • From source: c:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\
  • Target: c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\

Microsoft.QualityTools.Testing.Fakes.ImportAfter.targets:

  • : c:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Microsoft.Common.targets\ImportAfter\
  • : c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Microsoft.Common.Targets\ImportAfter\

Microsoft.QualityTools.Testing.Fakes.dll:

  • : c:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\
  • : GAC/%windir%\Microsoft.NET\assembly

. .

+5

, .

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0, Fakes. , TestTools .

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Microsoft.Common.Targets\ImportAfter, Microsoft.QualityTools.Testing.Fakes.ImportAfter.targets, . .

, , , Microsoft.QualityTools.Testing.Fakes.dll GAC , MSBuild .

MS Build Tools 2017 .

+4

All Articles