简体   繁体   English

无法在 Visual Studio 中自动导入命名空间

[英]Not able to import namespaces automatically in Visual Studio

I am new to C#, I have been working on Java.我是 C# 的新手,我一直在研究 Java。 So when I write any class name in Visual Studio, VS do not import or show suggestions to import namespaces,unlike we do in my Eclipse by CTRL+SPACE .因此,当我在 Visual Studio 中编写任何类名时,VS 不会导入或显示导入命名空间的建议,这与我们在 Eclipse 中通过CTRL+SPACE所做的不同。

I used CTRL + .(dot) and CTRL+SHIFT+F10 but they did not help.我使用了CTRL + .(dot)CTRL+SHIFT+F10但它们没有帮助。 I am really frustrated, please suggest any idea.我真的很沮丧,请提出任何想法。

Your help will be appreciated.您的帮助将不胜感激。 Thanks谢谢

If you have a namespace in a different DLL in your project, you first need to right-click references and select " add reference " and then checkmark the dll.如果您在项目中的不同 DLL 中有命名空间,则首先需要右键单击引用并选择“添加引用”,然后选中该 dll。

After doing this, CTRL+DOT will work :)执行此操作后,CTRL+DOT 将起作用:)

If it is a reference to an external package, such as NuGet, you can right-click the solution file and choose "Restore Nuget Packages"如果是对外部包的引用,比如NuGet,可以右键解决方案文件,选择“Restore Nuget Packages”

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

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