Managing Enterprise Template-Based Projects Through Source Control
The Visual Studio integrated development environment (IDE) provides easy access to all the products within Visual Studio .NET. When you are developing Enterprise Template-based solutions, Visual SourceSafe is particularly useful as a means of keeping track of each aspect of the project and ensuring the safety of the individual files.
Visual SourceSafe helps manage your projects no matter what the file type (text, graphics, binary, audio, or video files) by saving them to a database. When you need to share files between two or more projects, you can do so quickly and efficiently. When you add a file to Visual SourceSafe, the file is backed up in the database, made available to other developers on the team, and changes that have been made to the file are saved so you can recover an older version at any time. Members of your team can see the latest version of any file, make changes, and save a new version in the database.
Visual SourceSafe and Enterprise Template-Related Behavior
Enterprise Template projects work with Visual SourceSafe in much the same manner as typical language projects. The only exception is when you add one of the Distributed Application projects. Any Web projects in it are treated separately by Visual SourceSafe and not as child projects. This creates a problem that is relatively easy to solve.
For example, if you open a Visual C# distributed application project called Project1 and add it to your local Visual SourceSafe database, Visual SourceSafe does not add the project to an existing folder. Rather, it prompts you to create a new folder. In addition, because a Visual C# distributed application project contains subprojects, Visual SourceSafe prompts you to create new subfolders for each of them.
After Visual SourceSafe creates the project's folders, it asks you whether you want to save WebUI, a Web project within the Visual C# distributed application. If you accept the default folder location that Visual SourceSafe provides, the Web project is saved in a folder named WebUI that is not under Project1. Assume you then create another C# distributed application project called Project 2 and also add it to Visual SourceSafe. Again, you accept the default folder location when prompted to save its WebUI project. This WebUI project would then be saved in the same folder as the first WebUI project, overwriting any identically named files in the process.
To avoid this problem, save every WebUI project into a Visual SourceSafe subfolder that resides under its top-level project, as shown in Solution Explorer. The following procedure shows how to do this. It assumes that the source control system you are using is Visual SourceSafe.
To save the WebUI project with your top-level project
- In Visual Studio .NET, create a new Visual C# distributed application project, naming it, for example, Project1. To learn how to do this, see Creating an Enterprise Application's Initial Structure.
- Add Project1 to Visual SourceSafe. To do this, right-click the Project1 project in Solution Explorer and then click Add Solution to Source Control.
- If you are not already logged on to Visual SourceSafe, a dialog box appears prompting you to log on. Supply the requested information (such as your name, password, and name of the source control database) and click OK.
- In the Add to SourceSafe Project dialog box, choose a location in the Visual SourceSafe folder hierarchy into which Visual SourceSafe will add the top-level folder of your new project and click OK.
- A dialog box appears that asks Project $/<VSS path>/Project1 does not exist, would you like to create it? Click Yes.
- One or more Add to SourceSafe Project dialog boxes appear, asking you where to place the Web projects (such as "WebService" or "WebUI"). In each case, navigate the Visual SourceSafe folder hierarchy to find the location of your new project (Project1), click that project folder to open it, and click OK. Depending on your existing folder structure, dialog boxes with the following questions might appear:
- Project $/<VSS path>/<ProjectName> does not exist, would you like to create it?
- Folder <folder path> not found, create?
For either question above, click Yes.
In Step 6, you placed the Web projects under your top-level project in Visual SourceSafe. By following this method whenever you save a distributed application with Web projects to Visual SourceSafe, you avoid overwriting existing Web projects with Web projects from new solutions.
Security Note If you receive an Enterprise Template project (.etp) or policy (.tdl) file from a potentially untrusted source, the policy file could contain settings that can cause problems or nuisance events. Before using a questionable .etp or .tdl file, you should open it in a text editor and inspect it for things such as unnecessary references, unknown scripts, or inappropriate constraints. For more information, see Avoiding Nuisance Risks with .etp Files, Avoiding Nuisance Risks with Policy Files, and Avoiding Risk of Malicious Property Constraints.