开发者

"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?


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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜