Binding deployment projects to Source Safe: The dreaded "valid binding root" message

by Scosby Monday, April 6, 2009

If you have ever tried to bind a deployment project to Source Safe without adding the solution file as well you've probably pulled your hair out. At least I have. Let's say you add your *.vdproj to source safe then go and attempt to bind the project from Visual Studio. Normally, when working with other projects such as *.csproj, Visual Studio binds the project nicely and life goes on. However, it is likely you will encounter the following message from Visual Studio:

The folder you have chose is not a valid binding root for the projects you have selected. You attempted to retarget a solution to a source control folder that is not within the solution's root. In the change source control dialog box, specify the root for the solution. Select the folder <X> levels higher in the tree to change the source control bindings correctly.

I hate this dialog message. There might be a "correct" (read: ridiculous) way to get Source Safe to bind to my deployment project in a manner consistent with the rest of Visual Studio projects, but alas, I could care less. Here is one alternative, which I happen to find easier and a great cure for this headache. This assumes you have already added your *.vdproj file to source safe (and not the solution file, b.c. we don't want that in Source Safe after all)

  • Create a solution for your deployment project.
  • Close the solution in Visual Studio.
  • Open the *.sln with notepad, or your text editor de jour.
  • Locate the 'Global' section.
  • Directly beneath the 'Global' section we can manually add our Source Safe bindings w/o hassle.
    • Note: It might be a good idea to compare this section with another project you have successfully bound already.
  • Save the *.sln and close your text editor
  • Reopen and enjoy a nice, cleanly bound, deployment project.

Here is an example of the configuration you need to insert directly under the 'Global' section:

 GlobalSection(SourceCodeControl) = preSolution
  SccNumberOfProjects = 1
  SccProjectUniqueName0 = myDeployment.vdproj
  SccProjectName0 = \u0022$/YourSouceSafeRoot/YourProjectRoot/YourProjectSubfolderRoot/Install\u0020Project\u0022,\u0020THNBAAAA
  SccLocalPath0 = .
  SccProvider0 = MSSCCI:Microsoft\u0020Visual\u0020SourceSafe

Note the bolded "\u0020" text. This is the Unicode value for a space <SP>, meaning "Install Project" = "Install\u0020Project". Be sure to begin and end your "SccProjectName0" line with the Unicode value for double quotes ( \u0022). Finally, we add some identifiers (which I'm guessing are permissions) with the "\u0020THNBAAAA" characters.

While it's ultimately dangerous to edit solution files by hand, they are editable for a reason. This situation is a good example of where a quick text edit can save loads of hassle and is worth the risk. However, I wouldn't recommend this approach for other solution binding problems, only for deployment projects.

Tags: ,

IT | Programming