Source Control Bindings explained

By source control bindings is understood the association between a folder on a local drive (e.g. "C:\My Projects\Project1") and a folder/project in the source control database (e.g. $/Project1 for Visual SourceSafe)

Visual Studio uses one binding per each controlled project. Because each binding require a connection to the source control database, Visual Studio tries to minimize the number of bindings in a solution by grouping projects that can share the same bindings. You can use the "Change Source Control" dialog to view the projects bindings. For instance, the picture below shows a solution with 9 projects, 7 of them sharing the bindings with the solution. The projects that share bindings appear as grouped lines in the Change Source Control dialog.

In order to establish the bindings, Visual Studio will determine each project's unified root. This folder is the closest folder that contains all the project files. For instance, for the next project, that includes all the listed files, the Unified root of the project is "C:\My Projects\Project1".
	C:\My Projects\Project1\project1.sln
	C:\My Projects\Project1\project1.vcproj
	C:\My Projects\Project1\ASource.cpp
	C:\My Projects\Project1\ASource.h
	C:\My Projects\Project1\Includes\AHeader.h 
(In this case, the project's unified root is the same as the project's folder, but this is not a rule.)
Of course, when a project contains files on multiple drives, such real-folder cannot be established. Visual Studio will use in that case the closest folder that encapsulate all the files on the same drive as the project file The files on other drives cannot not be controlled as part of that project (but can be controlled as part of ohter project in the same solution)

Using the same idea there can be determined another folder, solution's unified root. This folder is the closest folder that encapsulate the solution file, solution items, and all the files in all the projects in the solution. For instance, for the solution below containing two projects, Project1 and Project2, the solution's unified root is the "C:\My projects" folder, so it will be above all the files in both Project1 and Project2. When such solution gets added to source control, Visual Studio will use for both projects and the solution the same binding folder, "C:\My projects" to minimize the number of connections to the source control database.

	C:\My Projects\Project1\Project1.sln
	C:\My Projects\Project1\project1.vcproj
	C:\My Projects\Project1\Source1.cpp
	C:\My Projects\Project1\Source1.h
	C:\My Projects\Project2\Project2.vcproj
	C:\My Projects\Project2\Source2.cpp
	C:\My Projects\Project2\Source2.h 

When Visual Studio adds a project to source control, it will attempt to select as the binding's local folder the project's unified root. The binding's remote folder can be whether selected by the user during the add operation, or can be automatically calculated by the source control provider. When adding multiple projects at once, Visual Studio will try to minimize the number of bindings, and will use the unified root of the projects' unified roots (if you add the whole solution, this folder is the solution's unified root).

When a project is added to source control, any file that is part of that project and is under the project's binding folder will be controlled using that project's bindings. A file cannot be part of two controlled projects that have different bindings and be controlled in both projects. The file will appear uncontrolled in one of the projects in that case (but you can change the project's bindings using the Change Source Control dialog to make them use the same bindings if you need to control the file in both projects) . A file that is added to a controlled project outside the project's binding folder will appear as uncontrolled, unless the project's bindings are changed (basically, when such files is added, the project unified root changes logically, but the binding folder is not automatically changed to match this binding).

Q: Where are the source control bindings stored?
A: The source control bindings and other source control related settings for a solution or project in Visual Studio .NET might be stored in various places:
- in the solution file (.sln), in a "SourceCodeControl" section
- in the project files (.vcproj, .vbproj, .csproj, etc). This section depends on the project type, but generally there are 4 strings saved there (SccProjectName, SccAuxPath, SccLocalPath and SccProvider)
- in the solution options file (.suo) there are stored web projects' translations table, offline statuses, etc.
- in the project or solution hint files (.sln.vssscc, .vcproj.vspscc, and rarely in .vsscc)
- in the file mssccprj.scc, which is provider specific
(If you're asking yourself, the file vssver.scc is just a cache file specific to SourceSafe and is not related to source control integration in Visual Studio)

Q: How to remove a project from source control integration?
A: The best and recommended way is to use the File/Source Control/Change Source Control dialog, select the desired project or solution, then press the Unbind button. It will remove all the necessary source-control related information from all the files listed above. If you obtain an "Unspecified error" message, you might be unlucky, but there is still hope. You can manually remove the source control information from the solution and project files and delete the source control related files mentioned above.

(Back to SourceSafe and source control integration page)