posted on Sunday, August 31, 2003 4:00 PM by Kris

Found the SourceSafe Switch!

I knew there was a way to switch VSS-databases by changing registry settings, but I prefer a little tool when I want to switch databases. Since I have also a GotDotNet WS, I now and then like to update some sources.

Some sources I change more often locally, while the workspace updates I do once per week.
DevHawk helped me out!

While GDN Workspaces are very cool, and the integration with VS.NET makes it very easy to use, not all of my projects use GDN workspaces as a SCC system. Unfortunately, the SCC API only supports a single "current" SCC system at a time. I didn't find any documentation about how to switch what SCC API considers "current" but it turned out to be pretty easy to figure out. Details are below, plus I'm providing a simple tool (with source) to easily switch the current SCC provider.

SCC API uses a registry key to store two important pieces of information. The first is the currently selected provider. The other is a list of all installed providers. The availability of the list made creating the SccSwitch tool very trivial (the whole app is under 150 lines of code).

The main SCC API registry key path is HKLM\SOFTWARE\SourceCodeControlProvider. This key has a single value named "ProviderRegKey". It contains a string value with the path (in the HKLM hive) to the settings for the SCC Provider. For example, my ProviderRegKey is currently set to "Software\Microsoft\SourceSafe", which means I'm using VSS as my integrated source control provider. That registry path holds information such as the dll that implements the SCC API as well as provider specific information.

Under HKLM\SOFTWARE\SourceCodeControlProvider is a subkey named "InstalledSCCProviders". This key contains multiple string values, one for each installed SCC API. For example, on my system I have two installed SCC Providers - SourceSafe and GotDotNet Workspaces. The value data for each contains the registry key path for that specific SCC API provider. To change the current SCC provider, simply copy the desired provider registry path into the ProviderRegKey value described above.

Since the list of installed providers is readily available, building a utility to switch them is simple. On load, SccSwitch iterates the InstalledSCCProviders key for all the values, placing them in a checked list box. It auto checks the currently selected SCC provider as it loads. If the user selects a different provider, the update button is enabled and the other items get unchecked. When the enabled update button is pressed, the correct provider registry key is looked up from the registry and written to the ProviderRegKey value as detailed above. That's all there is to it!

Comments