Solutions and Web Site Source Control

If you are working in a solution that contains multiple Web sites, you can put the entire solution under source control as a unit. Working with a multiple Web site project solution is much the same as working with a single Web site project. The same functions are available, including the ability to check in or out an entire solution at once.

Repository Structure When Adding a Solution with Multiple Web Sites to Source Control

If you are adding a solution with more than one Web site to source control, the Microsoft Visual Web Developer Web development tool creates a different structure in the source control repository than it does for a single Web site project. For solutions that contain Web sites in a path that is relative to the solution file, Visual Web Developer creates a nested project structure in your source control repository. For example, if you have a solution file in C:\WebSites\SampleSolution.sln, and you have a Web site in C:\WebSites\SampleWebs\Web1, these paths are considered relative. Visual Web Developer attempts to maintain the relative structure. Any additional Web sites that are in the solution are created as separate child projects using the name that you assigned to the Web site.

Visual Web Developer initially creates a project with the extension .root. This project acts as the parent project for the individual Web site project. Within the parent project, Visual Web Developer creates a structure that looks similar to the following:

  • <SolutionName>.root

    • <SolutionName>\<relative path to the solution file>

      Stores the .sln file with the solution and project configuration settings.

    • <SolutionName>\<relative path to file system Web site>

      Stores the files for a Web site in the solution. In Visual Web Developer, the first Web site that you create in a solution has the same name as the solution. Thus, Visual Web Developer assigns the suffix _1 to the source control project for the Web site, which distinguishes it from the source control project that stores solution settings.

    • <name of non-relative file system Web site>

      Stores files for an additional Web site in the solution.

    • <name of client project>

      Stores client project files.

Enlisting

When you use Visual Web Developer to retrieve a copy of the solution from source control for the first time, Visual Web Developer creates the correct structure on your computer.

If you enlist in a solution that contains a Microsoft Internet Information Services (IIS) Web site that does not already exist on the local computer, Visual Web Developer creates the Web site beside the solution structure and points your virtual directory to that location.

If you enlist in a solution that contains an IIS Web site, and the virtual directory for the Web site already exists on your local computer, Visual Web Developer displays a dialog box asking if you want to add the files from source control to the existing Web site instead of creating a new folder. If you click Yes, Visual Web Developer uses the existing location. If you click No, Visual Web Developer creates a new folder with an underscore and a 1 (_1) appended to the name.

Checking Out Files

When you check out files in Visual Web Developer, your local version of the file is checked out in source control.

See Also

Other Resources

Source Code Control for Web Sites