How to manage multi-project solutions in Visual Studio .NET or in Visual Studio 2005

Summary

The information in this article applies to Microsoft Visual Basic .NET or Microsoft Visual Basic 2005. This article explains how to create a multi-language, multi-project solution that contains four different types of projects. After you create the solution, the focus of the article shifts to how to manage the build configuration and startup projects for the various projects in the solution.

Requirements

The following items describe the recommended hardware, software, network infrastructure, skills and knowledge, and service packs that you will need.
  • SQL Server 7.0 or later with the Northwind database.
  • Microsoft Visual Studio .NET or Microsoft Visual Studio 2005.
Applies To:
  • Visual Studio .NET or Visual Studio 2005
  • Visual Basic .NET or Visual Basic 2005
  • C#
Prior Knowledge required:
  • None, but familiarity with SQL Enterprise Manager is helpful.

Managing Multi-Project Solutions in Visual Studio .NET or in Visual Studio 2005

This article describes how to create a multi-language, multi-project solution that contains four different types of projects. After you create the solution, the focus of the article shifts to how to manage the build configuration and startup projects for the various projects in the solution.
  1. Click Start, point to Programs, point to Microsoft Visual Studio .NET, and then click Microsoft Visual Studio .NET.

    Note In Visual Studio 2005, lick Start, point to Programs, point to Microsoft Visual Studio 2005, and then click Microsoft Visual Studio 2005.
  2. On the File menu, click New Project.
  3. In the New Project dialog box, click Visual Basic Projects under Project Types, click Visual Basic Projects, and then click ASP .NET Web Service under Templates.

    Note In Visual Studio 2005, click Visual Basic in the Language box in the New Web Site dialog box.
  4. In the Location field, replace "WebService1" (without quotation marks) with "HowToWebService" (without quotation marks), and then click OK.
  5. In Solution Explorer, right-click Solution HowToWebService, point to Add, and then click New Project.
  6. In the New Project dialog box, click Visual C# Projects under Project Types, and then click Windows Application under Templates.

    Note In Visual Studio 2005, click Visual C# under Project Types.
  7. In the Name field, type HowToClient, and then click OK.
  8. Right-click Solution HowToWebService, point to Add, and then click New Project.
  9. In the New Project dialog box, click Other Projects, and then click Database Projects.
  10. In Templates, click Database Project. Name this project "HowToDB" (without quotation marks), and then click OK.
  11. In the Add Database Reference dialog box, click Add New Reference.
  12. In the Data Link Properties dialog box, type localhost as the server name.
  13. In the User name field, type sa, and then click to select the Blank Password check box (or type the appropriate credentials for your local SQL Server).
  14. In the bottom drop-down menu, click Northwind, and then click OK.
  15. Right-click Solution HowToWebService, point to Add, and then click New Project.
  16. In the New Project dialog box, click Setup and Deployment Projectunder Project Types, and then click Setup Project under Templates.
  17. In the Name field, type HowToSetup, and then click OK.
  18. In Solution Explorer, right-click HowToSetup, point to Add, and then click Project Output.

    This determines what the deployment project packages up and installs.
  19. In the Add Project Output Group dialog box, click HowToClient on the Project menu, click to select the Primary Output check box, and then click OK.
  20. In Solution Explorer, right-click HowToSetup, point to View, and then click Custom Actions.

    Note that adding "Primary output" is the only requirement for a proper installation.
  21. Right-click Custom Actions, and then click Add Custom Action.
  22. In the Select Item in Project dialog box, click Application Folder on the Look in menu.
  23. Under the Look in menu, click
    Primary output from HowToClient (Active), and then click OK.
  24. Press CTRL+SHIFT+S to save the solution.
  25. In Solution Explorer, right-click Solution HowToWebService, and then click Set Startup Projects.
  26. In the Solution HowToWebService Property Pages dialog box, click Multiple Startup Projects.
  27. In the Action column, click Start without Debugging for both projects.
  28. Click OK.
  29. Right-click Solution HowToWebService, and then click Configuration Manager.

    The dialog box that appears permits you to set which Projects are built and the build configuration.
  30. In Configuration, click to select the Release check box for HowToClient, click to select the Build check box for HowToSetup, and then click Close.
  31. Press CTRL+SHIFT+B or right-click the Solution file, and then click Build Solution.

    The Output window displays the continuous build output, which should end with "Build: 3 succeeded, 0 failed, 0 skipped" (without quotation marks).
  32. Right-click HowToSetup, and then click Build. (To build each project individually, right-click the Project and, then click Build.)
  33. Press CRTL + F5 to build, and then run the Solution. After the Solution is built both the Windows Form from the HowToClient application and the Service1.asmx file for the HowToWebService starts to indicate that both projects have started.

REFERENCES

For more information about Solutions, Projects and Items, see the following Microsoft Web sites.

NOTE: The following liks are available only if you have the Microsoft Visual Studio .NET documentation installed on your computer.
Propriedades

ID do Artigo: 317786 - Última Revisão: 13 de mai de 2008 - Revisão: 1

Comentários