Choosing Visual Studio StartUp Projects
Visual Studio allows many projects to be gathered into a single solution. When using such solutions it is important to be able to identify one or more of the projects as startup items. These projects are started automatically when starting debugging.
Visual Studio Solutions
A Visual Studio solution is a collection of projects and other related files. The individual projects may compile to executable files, dynamic linked libraries, services, etc. In some solutions only one project will be executable, with other projects providing supporting, shared code. More complex solutions may include multiple executable projects and services and may require that more that one project is executing simultaneously. In either case, it is important to be able to specify which projects should start when you begin debugging or executing your code.
Selecting a StartUp Project
The startup project is the project that will be executed by default when you click the start button or press F5. You can see which project is marked as the startup item in the Solution Explorer, as it is listed in a bold typeface. To change the startup project from the Solution Explorer, right-click the desired project and choose "Set as StartUp Project" from the context-sensitive menu that is displayed. You can also choose this menu item from the Project menu. To test that the project is correctly selected, press F5 to start it.
Selecting Multiple StartUp Projects
In some situations a solution will require that multiple projects are executing simultaneously. For example, you may have a web service that controls communication with a data storage solution and a Windows Forms application that uses that service. In these cases you can select multiple startup projects using the solution's properties. To do so, right-click the name of the solution in the Solution Explorer and choose "Set StartUp Projects". The solution's property page for startup projects, pictured below, will be displayed.
To indicate that you wish to have more than one startup project, first choose the "Multiple Startup Projects" radio button. You can then set the startup action for each project individually. For DLLs and other projects that you do not wish to run, choose "None". For projects that need to be running but that you do not need to debug, choose "Start without debugging". Finally, for those projects that you wish to attach to the debugger, select "Start". You can also use the buttons to the right of the list of projects to specify the starting order for the projects. Once you have finished, click OK and then press F5 to see all of the startup projects execute together.
26 November 2010