类型或命名空间无法找到,当参考确实存在 [英] Type or namespace cannot be found, when reference does exist

查看:163
本文介绍了类型或命名空间无法找到,当参考确实存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WPF应用程序中,我想引用一个类库,我已经建立。 我添加了一个参考的.dll 和我有using语句添加到我的文件,与智能感知实际看到了新的命名空间。

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.

然后在我的code我能在我的加入为.dll就好了创建类的新对象。智能感知看到的所有方法ect..no问题,没有错误。

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.

当我尝试建立我的WPF应用程序,所有的突然我得到的类型或命名空间无法找到的错误上加上我的DLL。

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.

然后我得到每当我试图从该.dll文件创建对象错误。

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

我不明白发生了什么事。为什么它的工作原理之前,我建立,但是当我建立它决定它不知道那里的.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?

此外,我已经到类库我试图添加和mades确保它没有错误的基础之上。

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

推荐答案

这样做的最常见的原因是,你的.DLL针对完整的.NET框架,但WPF应用程序面向客户端配置文件。

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

例如,如果您的图书馆面向.NET 3.5,请确保您的WPF应用程序目标的完整的.NET 3.5或4.0的框架,而不是客户端配置文件。

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.

这篇关于类型或命名空间无法找到,当参考确实存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆