System Definition Model (SDM) Documents Under Source Control

In Distributed System Designers, distributed system diagrams, such as the application diagram or system diagrams, are scoped at the solution level, while other System Definition Model (SDM) documents, such as application definition (.sdm) files, can be scoped at the project level. You can check these files in and out of source control like any other file. However, be aware of the following considerations regarding how these documents interact with source control, especially when synchronizing them.

For more information, see the following topics:

The following sections contain more information about how SDM documents interact with source control:

  • Checking Out Local Versions versus Server Versions

  • Adding SDM Documents or Certain Project Files from a Shared Solution

  • Synchronization Under Source Control

Checking Out Local Versions versus Server Versions

Depending on your source control settings, you can choose to check out a local version or a server version of a file. However, SDM documents do not support reloading during synchronization. Therefore, making changes to files while they are checked in and then checking out the server version of those files might prevent them from synchronizing with the solution if they are in the process of reloading. For example, if you are using Microsoft FrontPage source control integration with Web projects generated by Application Designer, changes to those projects might be silently excluded from synchronization if they are in the process of reloading.

Tip

To avoid this condition, check out the file prior to any operation that requires reloading the file or set your source control options to always check out the local version of the file.

Adding SDM Documents or Certain Project Files from a Shared Solution

If you are using Team Foundation version control, and you want to add an SDM document or certain project files, such as code files, from another solution to your solution, you will not be able to use the Open from Source Control dialog box to add the item to your solution. This dialog box does not display the option for you to select from all files or to select an item with an SDM file extension or certain other project file extensions, such as code file extensions. For more information, see How to: Open Solutions and Projects from Version Control.

To add these files to your solution, see How to: Add SDM Documents and Project Files from Shared Solutions Under Source Control.

Synchronization Under Source Control

When certain application definitions on the application diagram are implemented, an application project is generated for each of those definitions. The project contains files such as code files, configuration (.config) files, and an .sdm file. This .sdm file is an SDM document that contains metadata about the application definition.

When you make changes to the application diagram or make changes to code or .config files associated with a project, the application diagram and any .sdm files must be updated. Once an application is implemented, the code becomes the master definition even though code and diagrams synchronize with each other. If the application diagram is open, Visual Studio attempts to synchronize those changes immediately. For example, adding a Web service definition and an .asmx file to the project of an ASP.NET application or making changes on the application diagram that affect .sdm files triggers synchronization. For more information, see Synchronization Across System Definition Model (SDM) Documents.

Scenarios that Require or Do Not Require Checkout for Synchronization

Depending on the scenario, checkout might or might not be required during synchronization. If any files required for synchronization, such as the application diagram (.ad) file or .sdm files, are checked into Visual Studio source control, Visual Studio either checks out the required files automatically or prompts you to check out these files, depending on how source control user settings are set.

Note

You might see one or more checkout prompts, depending on the number of files required.

For example, if your solution contains an application diagram (.ad) file, and you add one or more projects (that were previously generated for applications on the application diagram) to the solution from source control, Visual Studio either checks out the .sdm files in those projects automatically or prompts you to check them out. Do not cancel checkout because the application diagram will become locked if the diagram is open or the next time the diagram is opened. For more information, see Canceling Checkout and Troubleshooting Application Diagrams.

Tip

When you finish working with SDM documents such as .sdm files, check them in so that other users can check them out, for example, when they want to add projects with .sdm files to solutions containing application diagram files.

Settings that represent entries in configuration (.config) files are stored in both .sdm files and .config files, even after implementation. Therefore, changes that you make to settings (or constraints) using the Setting and Constraints Editor or to any settings in a .config file that are also represented in the .sdm file require checking out the application diagram and .sdm file. For more information, see Applying Settings.

In contrast, when an ASP.NET application with a Web service is implemented, Web service operations are defined by the Web service class file and are no longer represented in the application diagram (.ad) file. Therefore, changes that you make to Web service operations using the Web Service Details window or directly in the code do not require checking out the application diagram as those changes affect the Web service class file. For more information, see Overview of ASP.NET Applications on Application Diagrams.

Canceling Checkout

You can choose to cancel checkout when prompted; however, canceling checkout prevents Visual Studio from synchronizing the necessary files. Depending on the changes that required checkout, cancelling checkout might cause the following to occur:

  • Changes made through the designer will be rolled back. The initial change and all subsequent changes are rolled back.

  • Changes made to code or configuration files cannot be rolled back.

    The application diagram (.ad) file will lock and appear in a read-only state. An error appears in the Error List window indicating that synchronization could not be completed. The read-only state of the application diagram indicates that it cannot synchronize with the associated project files and might contain unsynchronized information.

    To resolve this condition, close the diagram, reverse any changes that were not rolled back, and reopen the diagram, which attempts to synchronize the diagram. For more information, see Troubleshooting Application Diagrams.

  • Code might not compile and build errors might occur.

If the application diagram is checked into source control, synchronizing the diagram will require checking it out. However, if source control is set to check out the server version of the diagram, the diagram must be reloaded. Since SDM documents do not support reloading during synchronization, the diagram cannot be checked out. If the application diagram cannot be checked out, it cannot be synchronized and will lock. To resolve a locked application diagram, you can close and reopen the diagram, which attempts to synchronize the diagram.

To avoid this condition, check out the file prior to any operation that requires reloading the file or set your source control options to always check out the local version of the file.

Getting the Latest Version of SDM Documents

Getting the latest version of an SDM document while the application diagram (.ad) file is open will cause the diagram to lock and appear in a read-only state. This operation requires the application diagram to be reloaded and might cause these files to become unsynchronized. For more information, see Troubleshooting Application Diagrams.

To resolve a locked application diagram, close the diagram and then reopen it.

See Also

Reference

Concurrent Checkout and Changes to System Definition Model (SDM) Documents

Other Resources

Team Foundation

Distributed System Designer Overviews