#484 – Add a Project Reference to Use a Type from Another Project

Let’s say that you’re authoring two different projects in Visual Studio–one that will contain a type (like Dog) and one that will use that type.  You need to set up a project reference so that the project that wants to use the Dog class knows about the project that defines Dog.

Assume that the project containing the Dog class will be a class library (.dll) that we’ll call DogLibrary.  We’ll also generate a console application project (.exe) that uses the Dog  class, which we’ll call DogApplication.

To use the Dog class from the console application, we need to set up a project reference so that DogApplication knows about DogLibrary.  Right-click on DogApplication and select Add Reference…

On the Projects tab, which lists other projects in this solution, select DogLibrary and click OK.

In the References folder for DogApplication,  you’ll now see that this project references the DogLibrary project.

Advertisement

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: