简体   繁体   English

将库dll添加到引用后,类库Intellisense未显示

[英]Class Library Intellisense not showing up after adding the dll to the references

In C#, I made a ClassLibrary that has one Namespace and one Class. 在C#中,我创建了一个ClassLibrary,它有一个Namespace和一个Class。 I saved it and build it. 我保存并构建它。 in other Projects, when i use it, I add it to my references by browsing to the .dll location. 在其他项目中,当我使用它时,我通过浏览到.dll位置将其添加到我的引用中。

But The Problem is that its name is not showing up in the Intellisense. 但问题是它的名字没有出现在Intellisense中。 ie when I: using ... my dll doesn't show .. I'm Importing the library to a ConsoleApp. 即当我: using ...我的DLL没有显示..我正在将库导入ConsoleApp。 both of the App and the library target Framework is .NET Framework 4.0 and I made their Assembly Version 4.0.0.0 so they're the exact same. App和库目标框架都是.NET Framework 4.0,我制作了它们的Assembly 4.0.0.0,所以它们完全相同。

is there a setting or something that I'm missing ? 有什么设置或我缺少的东西? how can i make it pop up ? 怎么能让它弹出来?

I'm using VS2010 Professional 我正在使用VS2010 Professional

Thank you for your help 谢谢您的帮助

也许这很有用,我有一个类似的问题,我有一个Web项目,通过选择项目添加对类库的引用,但如果我对类库进行了更改,我看不到该更改Web项目的intellisense,在尝试了很多东西后,我看到在最近添加的引用中,选项“Local Copy”的值设置为“True”,然后我将其更改为false并且everething正常工作!

I had a similar issue but in my case it was a property on the class. 我有一个类似的问题但在我的情况下,它是班上的财产。 If you go to the file properties and look for a Build Action . 如果转到文件属性并查找“ 构建操作” Somehow mine was set to Content it had to be set to Compile . 不知何故我的设置为Content它必须设置为Compile

I am using Visual Studio 2013. I hope this helps someone else. 我正在使用Visual Studio 2013.我希望这可以帮助其他人。

Is the namespace for your assembly different than the namespace for your currently open project? 程序集的命名空间是否与当前打开的项目的命名空间不同? I've had times when the current project and an assembly share the same namespace path the intellisense can mess up. 我有时候当前项目和程序集共享相同的命名空间路径,智能感知可能会搞乱。

In general, Visual Studio is pretty good about intellisense generation, especially for C#. 一般来说,Visual Studio非常适合智能感知生成,特别是对于C#。 But sometimes there are some interesting conditions regarding ambiguities, and especially mixing project types where it just doesn't quite work. 但是有时会出现一些关于模糊性的有趣条件,特别是混合项目类型,它只是不起作用。

Placing your content in the same namespace makes me wonder if you've actually fixed the problem (it may just be autocompleting the namespace in the currently loaded project rather than the assembly), but if it allows you to continue working, then go with it! 将您的内容放在同一个命名空间中让我想知道您是否确实修复了问题(它可能只是在当前加载的项目而不是程序集中自动完成命名空间),但如果它允许您继续工作,那么请使用它!

Right click on project on which you add reference of your dll/project select menu project dependancies and select/MarkCheckBox for reference project/dll. 右键单击项目,在该项目上添加dll / project选择菜单project dependancies项的引用,并select/MarkCheckBox作为参考项目/ dll。 then it will work fine. 然后它会正常工作。

If the class library project had its name changed after creation, then intellisense may fail finding it due to directory issues, I believe. 如果类库项目在创建后更改了其名称,那么智能感知可能由于目录问题而无法找到它,我相信。

I created my class with the generic "ClassLibrary1" or whatever, and then later changed the default namespace, class name, and project name inside of VS2017. 我使用通用的“ClassLibrary1”或其他任何东西创建了我的类,然后更改了VS2017中的默认命名空间,类名和项目名称。 I closed VS2017 and changed the directory name to match my default namespace, and then re-associated the project file in VS2017, and then re-added the reference in my main project file. 我关闭了VS2017并更改了目录名以匹配我的默认命名空间,然后在VS2017中重新关联项目文件,然后在我的主项目文件中重新添加了引用。

All seems to be fixed now. 一切似乎现在都已解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM