简体   繁体   English

如何在Visual Studio 2010中添加引用

[英]How to add a reference in Visual studio 2010

Last time i add the reference from a plugin who work great but what i do if i want to do that in a visual studio without any plugin 上次我从一个工作得很好的插件中添加引用,但如果我想在没有任何插件的visual studio中这样做的话

in visual studio go to project choose add reference and their is no good way to add more plugin like search easily and add them. 在visual studio中去项目选择添加引用 ,它们不是一个很好的方法来添加像搜索一样的插件并添加它们。

i find the way to add that after open the add reference window choose .net tab and if you want to suppose 我找到了添加它的方法,在打开添加引用窗口后选择.net选项卡,如果你想假设

Microsft.Csharp then their is no search button or way to find them whenever listing have a thousands of thins their. Microsft.Csharp然后他们没有搜索按钮或方式找到他们每当列出他们的成千上万。 so in this condition choose any of component and type Microsoft then they move to a plugin who start With Microsoft. 所以在这种情况下选择任何组件并键入Microsoft然后他们转移到以Microsoft开始的插件。 if you press anything wrong then type backspace many time to sure that Microsoft is removed start again Microsoft. 如果您输入任何错误,请多次键入退格键以确保Microsoft已被删除再次启动Microsoft。

are this is not wired to add the component like many software have facelity to search when list have thousands of thing their preharps in Visual studio these thing goes hard to do that. 这是没有连线添加组件像许多软件有面子搜索时,在Visual Studio中列表有数千件事情他们的事情很难做到这一点。

very hard to do that when a list of plugin goes removed and you want to add them in your project. 当插件列表被删除并且您想要在项目中添加它们时,很难做到这一点。

Well Are their any trick you have when you not have any plugin and you want to do that easily. 好吧,当你没有任何插件并且想要轻松地做到这一点时,你有什么技巧吗?

i myself spent a time but problem not totally destroy as i want. 我自己花了一段时间,但问题并没有像我想要的那样彻底毁灭。

what is the best way or practice you use to add the reference in Visual studio 在Visual Studio中添加引用的最佳方法或实践是什么?

Visual Studio add-ins like Visual Assist X , Resharper of CodeRush will help you with this. Visual Assist X这样的Visual Studio加载项, CodeRush的 Resharper将为您提供帮助。

With either of these add-ins, you just use the class you want to use eg. 使用这些加载项中的任何一个,您只需使用您想要使用的类,例如。 FileInfo. FileInfo的。 The add-in detects this and understands you probably mean System.IO.FileInfo and offers you to add the namespace reference with one click (or offers you multiple namespaces if there is an ambiguity). 加载项检测到这一点并理解您可能意味着System.IO.FileInfo并提供您一键添加命名空间引用(或者如果存在歧义,则为您提供多个命名空间)。

System.Net.Mail is a part of System.Net. System.Net.Mail是System.Net的一部分。 Are you sure you are not just missing the using statement, to include the namespace in your code file? 您确定不仅仅缺少using语句,还要在命令文件中包含命名空间吗?

using System.Net.Mail;

Try adding that at the top of the file. 尝试在文件顶部添加。

On "trick" also is if you have added the reference, but not the using statement, and you write the class name you want to use in your program. 关于“技巧”也是如果你已经添加了引用,而不是using语句,并且你编写了要在程序中使用的类名。 Right click it, and choose Resolve . 右键单击它,然后选择“ 解决” The first option under resolve adds the using statement at the top for you automatically. 解决方案下的第一个选项会自动为您添加顶部的using语句。 The second one prefixes the class name with the namespace for you. 第二个为您添加名称空间的类名称前缀。

EDIT 编辑

I checked again just now, and System.Net.Mail is actually inside the System assembly, and not System.Net. 我刚才再次检查过,System.Net.Mail实际上是在System程序集中,而不是System.Net。 I assume that you have System referenced already, but on my VS2010, I can include System.Net.Mail as long as I have referenced System (and that is, of course, done by default). 我假设您已经引用了系统,但是在我的VS2010上,只要我引用了System(当然,默认情况下已完成),我可以包含System.Net.Mail。 Have you tried creating a new project, and just tried adding using System.Net.Mail without doing anything else? 您是否尝试过创建一个新项目,并尝试使用System.Net.Mail添加而不做其他任何事情?

If you have added the System reference, then you will also have the System.Net.Mail namespace by default. 如果添加了系统引用,则默认情况下还将具有System.Net.Mail命名空间。

Type using System. 使用系统键入。 at the top of your class & you will see the list of included namespaces 在您的班级顶部,您将看到包含的命名空间列表

我建议使用Microsoft的Productivity Power Tools扩展,它将“添加引用”对话框替换为可以搜索引用的对话框,以及许多其他功能。

Anirudha, Anirudha,

I've created a tool that will help you to achieve your goal. 我创建了一个可以帮助您实现目标的工具。 Muse VSReferences will allow you to add a Global Assembly Cache reference to the project from Add GAC Reference menu item. Muse VSReferences将允许您从Add GAC Reference菜单项向项目添加Global Assembly Cache引用。

在此输入图像描述

Regards... 问候...

Muse Extensions 缪斯扩展

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

相关问题 如何在Visual Studio 2010中引用辅助项目 - How to reference a secondary project in Visual Studio 2010 如何在Visual Studio 2010中正确引用dll? - How to correctly reference a dll in Visual Studio 2010? 在Visual Studio 2010的解决方案资源管理器中禁用添加引用 - Disabled Add Reference in Solution Explorer on Visual Studio 2010 添加服务引用未出现在Visual Studio 2010中 - Add Service Reference doesn't appear in Visual Studio 2010 "无法在 Visual Studio 2010 中编辑或添加引用文件的路径" - Cannot Edit or Add Path to Reference File in Visual Studio 2010 在Visual Studio 2010中使用“添加Web引用”添加服务时,如何访问服务方法? - How to Access the Service method when service is added using “Add Web Reference” in Visual Studio 2010? 如何在带代理的Visual Studio 2010中添加库包引用? - How do you add a Library Package Reference in Visual Studio 2010 with proxy? 如何在Visual Studio 2010中添加对外部配置文件的引用? - How do I add a reference to an external configuration file to Visual Studio 2010? 如何将HtmlAgilityPack添加到Visual Studio 2010项目 - How to add HtmlAgilityPack to the Visual Studio 2010 project 如何将数据库添加到 Visual Studio 2010 解决方案? - How to add a database to visual studio 2010 Solution?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM