So I’ve been playing with some C# in trying to mess with other stuff in some insane fun. Â Anyways I was getting this weird compiler error trying to build my c# components:
warning CS1685: The predefined type ‘System.Func’ is defined in multiple
assemblies in the global alias; using definition from
Well that is strange. Â Everything still worked, but I was getting screens full of this crap, so I was missing anything that didn’t build correctly from the CLI, so I had to find the source. Â I found this nice tip, by adding the following into the source, and compile again.
System.Runtime.CompilerServices.ExtensionAttribute x = null;
And running the compiler (yet again), I got this:
c.cs(17,33): error CS0433: The type
‘System.Runtime.CompilerServices.ExtensionAttribute’ exists in both
System.Core.dll: (Location of symbol related to previous error)
c:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll: (Location of symbol
related to previous error)
What is this? There is a System.Core.dll in my work area?
11/05/2010 Â 09:53 AM Â Â Â Â Â 667,648 System.Core.dll
Sure enough, there it is. Â I don’t know why it’s there, I don’t remember putting it there. Â Even though I wasn’t directly referencing it, for some reason it was getting pulled in.
D:\proj\zmq.net\b>c:\Windows\Microsoft.NET\Framework\v4.0.30319\csc c.cs /r:netm
Microsoft (R) Visual C# Compiler version 4.0.30319.18408
for Microsoft (R) .NET Framework 4.5
Copyright (C) Microsoft Corporation. All rights reserved.
c.cs(17,52): warning CS0219: The variable ‘x’ is assigned but its value is never
Now I can delete the added line, and I’ll get a silent compile.