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

 

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.

About Peter Kellner

Peter is a software professional specializing in mobile and web technologies. He has also been a Microsoft MVP for the past 7 years. To read more about Peter Kellner and his experience click here. For information about how Peter Kellner might be able to help you with your project click here.

Follow me:


Comments

  1. Peter,
    I just checked on a VM with a new install of VS2010 and selected General Development settings. The Solution file shows.

    I think the same default applies to C# settings.

    Mike

  2. Thanks Mike! I wonder if the defaults changed? I don’t really want to reset all at the moment.

Follow

Get every new post delivered to your Inbox

Join other followers: