Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
337 views
in Technique[技术] by (71.8m points)

c# - Type or namespace cannot be found, when reference does exist

I have a wpf Application in which I am trying to reference a class library i have created. I have added a reference to the .dll And i have added the using statement to my file, and the intellisense actually sees the new namespace.

Then in my code I am able to create new objects of classes in my added .dll just fine. the intellisense sees all the methods ect..no problem, no errors.

when I try to build my wpf application, all the sudden I get the type or namespace cannot be found error on my added dll.

Then i get errors whenever i am trying to create objects from that .dll.

I don't get what is happening.. why does it work before I build, but when I build it decides it doesn't know where that .dll is i am referencing?

Also i have gone to that class library i am trying to add, and mades sure it builds with no errors.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The most common cause of this is that your .DLL targets the full .NET Framework, but the WPF Application targets the Client Profile.

For example, if your library targets .NET 3.5, make sure your WPF Application targets the full .NET 3.5 or 4.0 framework, not the client profile.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...