views:

19

answers:

2

How can I make a class defined in Project 1 visible so I can declare objects of that type inside Project 2, if both projects are part of the same solution?

Thank you.

A: 

If the classes in Project 1 are defined in a different namespace, reference the namespace and then the class in the second project. Something like:

Project1NameSpace.Class1 varName;

Alternately, put a using statement at the top of Project 2's source code, e.g.

using Project1NameSpace;

Then, all public or internal classes inside Project 1 should be available in Project 2. (This is all assuming that both projects are in the same solution, as you mentioned.)

Note: You may have to add a reference to the project in your solution.

Michael Todd
A: 

Right click on project 2,
Press add reference
Wait while VS2008 take for ever to load the add reference dialog
Press the projects tab
Select project 1

Eric Fode