How to debug VS 2010 complaining about an unreferenced assembly that, well, isn't referenced?
I converted a solution from VS2008/.NET 3.5 to VS 2010/.NET 4.
I'm getting this:
error CS0012: The type 'xxx.yyy' is defined in an assembly that is not referenced. You must add a reference to assembly 'xxx, Version=1.0.0.301, Culture=neutral, PublicKeyToken=null'.
The thing is, there's no code in the project that uses type xxx.yyy, and also, none of the other assemblies referenced from this project refer to assembly xxx either.
Any suggestions on how I could debug this?
Update: Mistery solved.
Let's say the error is on a line of class A in assembly AAA.
It was caused by the fact that AAA.A implements interface AAA.IA that uses type BBB.B from a referenced assembly BBB.
In turn, the implementation of BBB.B uses the type xxx.yyy that the compiler w开发者_如何学Pythonas complaining about.
Mark Gravell's answer is of course the fix for the problem.
Usually that means that there is a member on the public API - often an interface or base-type, that is needed. The fix is simple: add the reference. The compiler won't be making it up; that reference must be used somewhere, else how would the compiler even know about it. If you give a more specific example, we can probably show why it is needed.
精彩评论