开发者

Referenced DLL not found because VS namespace wrong

I have a DLL that contains common types and routines. The assembly name and namespace are the same:

MyCompany.Tools.Common

I add a reference to this DLL and then I add a using statement to a file that wishes to use a type from the assembly:

using MyCompany.Tools.Common;

I then use one of the types in another assembly:

SafeInvoker.Invoke(this.pctBoxCLIP, delegate { this.pctBoxCLIP.Visible = value; });

So far all good, however when I now try and build the assembly, Visual Studio complains that:

"The type or namespace name 'Common' does not exist in the namespace 'MyCompany.Tools'

However, if I look in the Object Browser, I can see the namespace MyCompany.Tools.Common & all the types etc.

If I remove the reference to the DLL and add it again the error is removed until I attempt to b开发者_运维百科uild again.

Any idea what is going on here and how to resolve it?


Just solved exactly the same problem. I had one solution compiled with .NET Framework 4 Client Profile and the other one with .NET Framework 4 (Full).

After changing both to the Full framework, it started to work.


Sounds like every time you build your dll is getting replaced. I've had that happen to me just yesterday in VS2010. I removed the reference, deleted the library from bin, added both back and it still was happening. What I did was I removed the reference, deleted the dll from the bin folder, copied the latest version of the dll to a new directory (different from the location it was previously being referenced from) and referenced it from the new directory. Seemed to work afterwards. As to why it was happened, no clue.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜