.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> ASP.NET >> Post New Resource Bookmark and Share   

 Subscribe to Articles

For Beginners - Adding References in Visual Studio

Posted By:Jean Paul       Posted Date: December 02, 2010    Points: 75    Category: ASP.NET    URL: http://www.dotnetspark.com  

Adding References in Visual Studio sample application
 

This is a simple post that shows how to add reference to projects in Visual Studio.

Project 1: Run Visual Studio and choose File>New Project>Console Application

image

Project 2: This time from the Solution Explorer choose Add>New Project

image

In the appearing dialog, choose Class Library

Projects

Now in the solution explorer, you can see two projects as shown below.

image

Now we have to refer the ClassLibrary1 project in the ConsoleApplication1.

For this, right click on the References item under ConsoleApplication1 and choose Add Reference.

image

The following dialog will appear.

image

The first tab .NET refers to .Net libraries you can refer to.  They will be residing in the GAC (Global Assembly Cache)

The COM tab refers to the registered COM servers in your machine.

The Projects tab refers to your existing projects in the solution.  It will not show the project from where Add Reference is invoked.

The Browse tab helps us to locate the library by exploring through your machine folders.

The Recent tab remembers your recently added references.  It is easier to locate them.

Projects Tab

Our tab of interest is Projects tab.  Click on the Projects tab and you will be able to see the ClassLibrary1.  Select it and click Ok.

image

That completes adding the reference.

Testing

From the ConsoleApplication1, you can select the Program.cs and type the following.

namespace ConsoleApplication1

{

    class Program

    {

        static void Main(string[] args)

        {

            ClassLibrary1.Class1 class1 = new ClassLibrary1.Class1();

        }

    }

}

If you can build the entire thing, you are done successfully.


 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend