Click here to Skip to main content
Click here to Skip to main content

Multiple Projects in One Solution

, 22 Apr 2013 GPL3
Rate this:
Please Sign up or sign in to vote.
Multiple Projects in One Solution

Programming Tip for Visual Studio

When creating multiple executables that are closely related, it can be very beneficial to have several projects within one solution.

Background

I needed this when writing my Server and Client TCP applications. The Server was to be run on one computer while the Client runs on another. However, they are so inter-dependent on each other it was helpful to have both in the same solution. I was unable to find clear instructions so I wrote this tip. Here is a link to the article and project that prompted this need: My TCP/IP Article

Using the Tip

Start the project to create a solution and a project in the usual manner, but stop with the New Project dialog displayed. I have used C++ with MFC but I suspect this will work for all languages.

Normally at this stage, I fill in the [Project]Name and the solution name is automatically filled in. Then I click OK and go on. This time, after entering the [Project]Name, enter a solution name. For this example, the [Project]Name is First_Project and the solution name is Two_Project_Solution.

two_solution_dialog

Ok that and complete any selections you may need. The solution explorer should look something like this.

solution_explorer_1

That should all be familiar. In the above image I have jumped ahead a bit and selected the solution rather than the project just to highlight it.

The next step is to create the second project. Right click on the solution and select Add then New Project. The dialog field Location defaults to the location of the current project so just leave that field alone. Go through the same steps as for the first project and click the final OK.

My example named the second project Second_Project.

In the below image I have closed (un-expanded) the two projects so just the project names are shown.

solution_explorer_2

When writing your code, nothing changes. Select the solution and go to work.

The next change is for running your solution. Right click on the Solution and select Set Startup Projects. Here is the dialog.

select_startup.jpb

The default for me was Single startup project. In the image I have changed it to Multiple startup projects and opened the drop down box for the first project to show the options. When working my TCP/IP code, I would set one to Start and the other to Start without debugging. Start obviously implies Start with debugging.

That is it. Happy coding.

History

Original post: 22 April 2013  

23 April 2013, first image was incorrect, edited title.  

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)

Share

About the Author

bkelly13

United States United States
My career began as a navigation electronics technician on submarines in the U.S. Navy. (After a short stint on the battleship USS New Jersey, that was cool.) I worked the next several years as a technician while earning a BSCS in computer science. During my senior year I wrote code for part of a missile flight simulator. That was followed by too many years working with Fortran on the security system at Cape Canaveral Air Force Station. I worked a few years on CLCS (Checkout and Launch Control System for the space shuttle) until it was canceled by NASA, then became the lead antenna engineer for a portable range tracking system. Now I work on telemetry at an Air Force base.
If you work with telemetry please check out this BB: www.irigbb.com. Thank you.

Comments and Discussions

 
GeneralMy vote of 1 PinmemberManish K. Agarwal26-Apr-13 0:26 
General[My vote of 1] are you serious?!.. PinmemberSeishin#23-Apr-13 1:43 
GeneralRe: [My vote of 1] are you serious?!.. Pinmemberbkelly1326-May-13 8:22 
BugFirst Image Missing PinprofessionalTadit Dash22-Apr-13 21:26 
AnswerRe: First Image Missing PinmemberClifford Nelson23-Apr-13 6:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150327.1 | Last Updated 23 Apr 2013
Article Copyright 2013 by bkelly13
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid