0

My projects build fine in Visual Studio and also using MSBUILD on my machine. On the build agent however if I run MSBUILD I get the error below. I have already tried to specify a target framework of 4.0 but without success. Any other ideas?

"c:\Test\Test.csproj" (default target) (6) ->
(CoreCompile target) ->
  ItemSearchDelegate.cs(17,10): error CS0433: The type 'System.Action<T1,T2>' exists in both 'c:\Windows\Microsoft.NET\
Framework\v4.0.30319\mscorlib.dll' and 'c:\Windows\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.
dll'

What I find most interesting: some lines above that error from MSBUILD, I see:

 CSC : warning CS1685: The predefined type 'System.Action' is defined in multiple assemblies in the global alias; using definition from 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll' 

So it decides to use v4 just to complain a second later?

All I do is: open the command line at the location of the .CSPROJ file and run "msbuild". Nothing fancy.

Krumelur
  • 32,180
  • 27
  • 124
  • 263
  • is .net 4.0 installed on the build agent machine? What about on your machine? – John Saunders May 02 '13 at 09:39
  • @JohnSaunders Yep, installed on both. I have now also added a HintPath that points directly to the 4.0 version. Still same error. – Krumelur May 02 '13 at 09:46
  • (Is this using TFS build? Or another build system?) - it would be useful if you could obtain the entire command line that your build system is executing. – Damien_The_Unbeliever May 02 '13 at 09:59
  • 2
    The message is accurate, that type indeed exists in both those assemblies. There's something seriously messed up about the build machine configuration. It uses assembly references from both c:\windows\microsoft.net\framework *and* the GAC. That's completely inappropriate, especially so for .NET 4 projects. Reference assemblies must come from c:\program files\assembly references. I can't guess how you break msbuild like that. – Hans Passant May 02 '13 at 12:30

0 Answers0