Justin Poliey
Justin Poliey

Reputation: 16341

"System.Action claims it is defined" error

I'm building a Silverlight 4.0 application with .NET Framework 4.0, and I'm seeing this error:

Reference to type System.Action claims it is defined in 'c:\Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\mscorlib.dll', but it could not be found (CS1684) - c:\Program Files\MSBuild\Seesmic\SDP\Seesmic.Sdp.Utils.dll

In my project I have a reference to the same mscorlib.dll that it's claiming to be defined in. Any ideas?

Upvotes: 1

Views: 3949

Answers (3)

Adarsh Kumar
Adarsh Kumar

Reputation: 1150

Sometimes you create a class say 'YourClass.cs' in your project say 'YourProject.YourModule'. After some time, you comment out YourClass.cs content since you do not want it now. But you do not exclude that .cs file from your project. In such case, compiler will give you warning while building the project like 'claims it is defind'. This is because project file contains the entry for this .cs file. When someone tries to use reflection on that project dll then this error prevents the code from accessing that class since it is actually not present physically but only in project file.

Upvotes: 0

wimh
wimh

Reputation: 15232

Seesmic.Sdp.Utils.dll is probably requiring a different version of the mscorlib.dll because it was compiled referencing that different version. In Seesmic.Sdp.Utils.dll there is a class using System.Action as base class, that only works if you reference the same version of mscorlib.dll containing the same System.Action, otherwise you won't be able to use that class.

Upvotes: 0

Jon Skeet
Jon Skeet

Reputation: 1500515

That's an odd location for a DLL (within the MSBuild directory). Is it possible that it's trying to use a reference to a desktop assembly from within your Silverlight application? Admittedly with the assembly portability in v4 I'd half expect that not to be a problem, but it's worth looking into.

If you could give more details about how you're building and where Seesmic comes into the frame, that would help.

Upvotes: 1

Related Questions