CS1685:

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
‘c:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll’

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
‘d:\proj\zmq.net\b\System.Core.dll’ and
‘c:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll’
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
q.dll
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
used

Now I can delete the added line, and I’ll get a silent compile.

Yay.

This entry was posted in random updates by neozeed. Bookmark the permalink.
avatar

About neozeed

What is there to tell? I've loved UNIX like things since I was first exposed to QNX in highschool (we had the Unisys ICONS!), and spent the better time of my teenage years trying to get my own UNIX... I should have bought Coherent in retrospect.. Anyways latched onto Linux in 1992, and then got some old BSD admin books and have been hooked on the VAX BSD & other big/ancient things since...!

One thought on “CS1685:

Leave a Reply

Your email address will not be published.

Notify me of followup comments via e-mail. You can also subscribe without commenting.