无法找到类型或命名空间名称XXX(您是否缺少使用指令或程序集引用?) [英] The type or namespace name XXX could not be found(are you missing using directive or an assembly reference?)

查看:83
本文介绍了无法找到类型或命名空间名称XXX(您是否缺少使用指令或程序集引用?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,



我收到了以下问题,



我引用了DLL来自该项目并在程序中添加了使用来获取命名空间。



但它给出的问题是类型或命名空间名称XXX可以找不到(你是否缺少使用指令或程序集引用?)



我是否需要在App.Config文件中添加任何内容?



请帮我提供解决方案,提前致谢。



问候,

Srinivas

Hi Friends,

I got the below issue,

i've referenced DLL from the project and added Using in the program to get the namespace.

But it's giving the issue saying "The type or namespace name XXX could not be found(are you missing using directive or an assembly reference?)"

Do i need to add anything in the App.Config file??

Please help me by providing solution to this, Thanks in advance.

Regards,
Srinivas

推荐答案

引用程序集的项目可能与程序集具有不同的框架类型。



例如:

如果将表单项目更改为.Net Framework 4,则表单项目设置为.Net Framework 4 Client Profile。 ,它应该可以正常工作。
The Project which is is referencing the Assembly may have different framework type from the assembly.

for example:
Forms Project was set to ".Net Framework 4 Client Profile" if you change it to ".Net Framework 4", it should work fine.


没有。

通常情况下,只需参考和使用就足够了 - 你不需要添加任何东西。



将光标放在您尝试使用的类的名称。名称的右侧是否出现一条小红线?

如果是,请将鼠标悬停在它上面并在出现时打开下拉列表。这将为您提供解决问题的选择。



如果没有,它是否出现在左侧?

如果它确实,再次悬停鼠标,然后打开下拉菜单。如果这基本上是创建类而不是引用不正确 - 请仔细检查您的引用和类的DLL /命名空间。



如果这一切都失败了,尝试完全重新构建,看看会发生什么。
No.
Normally, just the reference and the using are enough - there is nothing else you should need to add.

Place the cursor in the name of the class you are trying to use. Does a small red line appear at the right hand side of the name?
If is does, hover the mouse over it and open the drop down when it appears. That will offer you options for solving the problem.

If it doesn't, does it appear at the left hand side?
If it does, hover the mouse again, and open the drop down. If this is basically "create the class" than the reference is not in properly - double check your references and the DLL / namespace for the class.

If all this fails, try a full re-build and see what happens.


我只能得出结论,你没有引用所有正确的DLL,因为你不需要任何其他的东西。



有一些问题需要注意



相同的命名空间可以在多个dll中使用。 />


如果您编写了一个调用 system.web 的项目(称之为projectA),然后编写另一个项目(调用它引用projectA的projectB),你还需要在projectB中添加对 system.web 的引用。
I can only conclude that you haven't referenced all the correct DLLs as you don't need to anything else.

There are a few gotchas to be aware of

The same namespace can be used in multiple dll's.

If you have written a project (call it projectA) that calls system.web and then write another project (call it projectB) that references projectA, you will also need to add a reference to system.web in projectB too.


这篇关于无法找到类型或命名空间名称XXX(您是否缺少使用指令或程序集引用?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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