With Visual Studio 2011, How To Add a Second Project To a Solution

Posted by Peter Kellner on June 06, 2011 · 2 mins read

 

Say you have an existing Microsoft Windows Forms Application and you want to create a class library for it to reference.  For some reason, I’ve been stuck with this problem for a while now and I accidentally found the “unintuitive” button by accident of how to do this. My expectation was that when I created a new solution in Visual Studio 2010, that it would show 1 project in the solution and then to add more projects, I’d right mouse button on the solution and say “Add New Project”.  Sadly, the solution explorer does not show me my solution, just the one project I have in it, regardless of whether I opened it directly (for which I think it creates it’s own solution) or I opened from my newly minted solution file.

That is, here is what I get when I create an empty solution, then add one project to it (no solution showing!)

 

image

So, I just discovered that when you go and “create a new project”, you get a dropdown in the “Solution Name” that says either “Add to Solution” or “Create new solution”.  Cleary, I want the first one.

 

image

image

 

Now, my solution is back and I can add more projects to it as I would expect.

 

image

 

This is not a big deal, but it did have me confused for a while so I thought I’d blog about it.

HTH’s.