Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reference a secondary project in Visual Studio 2010

I have project A, a C# console application which I want to reference my project B, a C# class library. My goal is to be able to make use of objects in Project B from within Project A, and see the source tree for both projects in the same Solution Explorer. I can of course make a reference from Project A to the built .dll that Project B outputs and use the objects in that fashion, but this doesn't give me the control I would like.

I'm having difficulty achieving this. I assume it should be found in Add Reference -> 'Project' tab, but I don't see any items in that tab window and can't figure out how to populate it. Am I missing something here? Both projects target .NET 4.0 framework and I am using Microsoft Visual Studio 2010 Version 10.0.40219.1 C# Express with ENU Service Pack 1 (KB983509).

Any help would be appreciated, thank you.

like image 594
user1277671 Avatar asked Dec 04 '22 04:12

user1277671


1 Answers

  1. Open Project A
  2. File - Add - Existing Project
  3. Open the .csproj file for Project B

You should now be able to see the source for both projects as part of the same solution.

Now from Project A:

  1. Add Reference
  2. Go to Projects tab
  3. Select Project B

Project A will now be able to use the types declared in Project B.

like image 135
Chris Fulstow Avatar answered Dec 05 '22 18:12

Chris Fulstow