简体   繁体   中英

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

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.

i find the way to add that after open the add reference window choose .net tab and if you want to suppose

Microsft.Csharp then their is no search button or way to find them whenever listing have a thousands of thins their. so in this condition choose any of component and type Microsoft then they move to a plugin who start With Microsoft. if you press anything wrong then type backspace many time to sure that Microsoft is removed start again 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.

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 add-ins like Visual Assist X , Resharper of CodeRush will help you with this.

With either of these add-ins, you just use the class you want to use eg. 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.Net.Mail is a part of System.Net. Are you sure you are not just missing the using statement, to include the namespace in your code file?

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. Right click it, and choose Resolve . The first option under resolve adds the using statement at the top for you automatically. 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. 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). Have you tried creating a new project, and just tried adding using System.Net.Mail without doing anything else?

If you have added the System reference, then you will also have the System.Net.Mail namespace by default.

Type using System. at the top of your class & you will see the list of included namespaces

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

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.

在此输入图像描述

Regards...

Muse Extensions

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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