31

I'm trying to add a project that contains some classes as a reference to another project, but I have not got, all your suggestions will be great

Thank you

enter image description here

3
  • 5
    Add both projects to the same solution. Then one project can add a "Project Reference" to the other project. Commented May 23, 2016 at 18:01
  • 2
    can you just make it a dll then reference the DLL. If you add one solution 2 projects, then you would have to all the files to your 2nd project which could work, but would have double maintence Commented May 23, 2016 at 18:16
  • 1
    What ? You do not have double maintenance. The project from solution A is referenced into solution B. Maintenance stays the same. Commented May 23, 2016 at 18:39

1 Answer 1

58

Do the following:

  1. Open the File menu.
  2. Choose Add, then Existing project
  3. Add the project you want into your solution

senter image description here

  1. From the solution explorer, select the References item of the project you want to need to reference the "other project" into.

  2. Click on Add reference

  3. Choose the project item

  4. Add your other project as reference to the main project.

enter image description here

Alternatively, you can compile the other project as DLL and add it (as dll) to your main project.

Sign up to request clarification or add additional context in comments.

4 Comments

How should one proceed if the references (like nuget packages) from the project being added as a reference themselves show as broken references in your main project?
@sergeidave I think what you want to do in this case is to right-click the solution and click on the "Restore nuget packages" element.
I tried restoring them multiple times but they show up still broken. The thing is that when I open the external projects by themselves with their own sln file, their references show up just fine, but when I open the main sln file, from the solution to which I've added these external projects, their references now show up broken when viewed in the main sln.
@sergeidave I f you did not already figure it out, you should create a separate question to have more visibility. This is sufficiently different from OP question and unfortunately, I have no clear answer on your specific case myself.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.