0

I have some projects that use the Fakes library for unit tests. The projects build successfully in Visual Studio, but when I try to build from the command line with msbuild, I get the following error:

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]

This question has actually been asked before, and has been answered in this Stack Overflow post. However, the answer in that post doesn't quite apply to my situation, because I'm using an msbuild executable that exists in a different folder structure. The answer in the above post only works for the msbuild path C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe, but I'm using the path C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe

Does anyone happen to know an equivalent solution that applies to my situation? Thanks

Ian Horner
  • 121
  • 3
  • You are using Net 4.0 (v4.0.30319). Should you be using a newer version of Net? – jdweng Aug 12 '20 at 15:51
  • It's an old project. This is the version that I need to be using. It was building successfully using v4.0.30319 on an old build server, and now I'm trying to get it working on a new server. – Ian Horner Aug 12 '20 at 16:23
  • You are using a newer version of VS so did you set the Target Framework to Net 4.0 in the project settings? – jdweng Aug 12 '20 at 16:33
  • Does new server have same version of Net installed as old server? After select Target to 4.0 try a clean build. The VS compiler dependencies to not recognize Net version changes so you probably have to do clean build (or delete bin and obj folders). Check if there are any dlls in the old server bin folder that may be missing. – jdweng Aug 12 '20 at 16:45

0 Answers0