SourceSafe Binding Removal Tool?

I am looking for a utility that will automatically remove the SourceSafe bindings based on the location of the solution file. I found a few mentions about this tool:

http://codebetter.com/blogs/darrell.norton/archive/2008/05/16/sourcesafe-binding-remover.aspx

This is similar to what I need - removes .scc files and modifies .sln and. * proj. However, I cannot figure out how to actually get the utility - the application in this post does not seem to actually exist.

Does anyone have a copy of this tool, or do you know where I can find something similar before rewriting it myself? I have 137 solutions for knotting, so manually this is not an attractive option.

+4
source share
6 answers

I wrote this type of utility not so long ago, and you are on the right track with what needs to be done.

Here is the code to get you started. It should work for all .Net projects (VS 2003 - VS 2008), including deployment projects:

//get list of all files to be edited/removed SlnFiles = new List<FileInfo>(SelectedDir.GetFiles("*.sln", SearchOption.AllDirectories)); ProjFiles = new List<FileInfo>(SelectedDir.GetFiles("*.*proj", SearchOption.AllDirectories)); VssFiles = new List<FileInfo>(SelectedDir.GetFiles("*.vssscc", SearchOption.AllDirectories)); VssFiles.AddRange(SelectedDir.GetFiles("*.vsscc", SearchOption.AllDirectories)); VssFiles.AddRange(SelectedDir.GetFiles("*.scc", SearchOption.AllDirectories)); VssFiles.AddRange(SelectedDir.GetFiles("*.vspscc", SearchOption.AllDirectories)); 

Delete VSS Files

 //Delete all vss files VssFiles.ForEach(vss =>{vss.Delete();}); 

Editing sln files

 //Edit sln files SlnFiles.ForEach(sln => { string fullName = sln.FullName; string relPath = sln.Directory.FullName.Replace(workingDir.FullName, string.Empty); StreamReader reader = sln.OpenText(); String text = reader.ReadToEnd(); reader.Close(); string regex = "\tGlobalSection\\(SourceCodeControl\\) [\\s\\S]*? EndGlobalSection\r\n"; RegexOptions options = ((RegexOptions.IgnorePatternWhitespace | RegexOptions.Multiline) | RegexOptions.IgnoreCase); Regex reg = new Regex(regex, options); text = reg.Replace(text, string.Empty); if (text.StartsWith(Environment.NewLine)) text = text.Remove(0, 2); StreamWriter writer = new StreamWriter(fullName); writer.Write(text); writer.Flush(); writer.Close(); }); 

Editing proj files

 //edit proj files ProjFiles.ForEach(proj => { string fullName = proj.FullName; string relPath = proj.Directory.FullName.Replace(workingDir.FullName, string.Empty); StreamReader reader = proj.OpenText(); String text = reader.ReadToEnd(); reader.Close(); string regex = "\"*<*Scc.*?(>|\\W=\\W\").*?(>|\")"; RegexOptions options = ((RegexOptions.IgnorePatternWhitespace | RegexOptions.Multiline) | RegexOptions.IgnoreCase); Regex reg = new Regex(regex, options); text = reg.Replace(text, string.Empty); StreamWriter writer = new StreamWriter(fullName); writer.Write(text); writer.Flush(); writer.Close(); }); 
+7
source

Here is a link to the newly created VSSBindingRemover . The software is based on answers from Jeremy and juanjo.arana. You can download the source code and executable from GitHub.

+3
source

If this only affects the file system that you should process, the command line commands should be able to:

 del *.scc /s /q attrib -r *.* /s 
+1
source

add the following code to set the file as read-only before you delete it:

var allFiles = slnFiles.Union (projFiles) .Union (vssFiles) .ToList ();

allFiles.ForEach (f => f.IsReadOnly = true);

+1
source

I use Cygwin, you: P

 find.exe . -type f -name *.dsp -print0 | xargs -0 -r perl -p -i.vssbak -e 's/^.*Scc_ProjName.*$//g' find.exe . -type f -name *.dsp -print0 | xargs -0 -r perl -p -i.vssbak -e 's/^.*Scc_LocalPath.*$//g' find.exe . -type f -name *.dsw -print0 | xargs -0 -r sed -i '/begin.source.code.control/,/end.source.code.control/d' find.exe . -type f -name *.sln -print0 | xargs -0 -r sed -i '/GlobalSection(SourceCodeControl)/,/EndGlobalSection/d' find.exe . -type f -name *.*proj -print0 | xargs -0 -r perl -p -i.vssbak -e 's/^.*SccProjectName.*$//g' find.exe . -type f -name *.*proj -print0 | xargs -0 -r perl -p -i.vssbak -e 's/^.*SccLocalPath.*$//g' find.exe . -type f -name *.*proj -print0 | xargs -0 -r perl -p -i.vssbak -e 's/^.*SccProvider.*$//g' find.exe . -type f -name *.vssbak -print0 | xargs -0 -r rm -f find.exe . -type f -name *.*scc -print0 | xargs -0 -r rm -f 
0
source

I have expanded the Mikael VSSBindingRemover application . Here is the complete list of changes:

  • Updated solution for Visual Studio 2010.
  • Updated project to .NET 4.0.
  • Regular expressions to remove blank lines in solution and project files after cleaning have been updated.
  • Added code to delete .suo files.
  • Modified code to remove read-only property in all files.
  • Added support for project types DTS (.dtproj), C ++ (.vcxproj) and Deployment (.vdproj).
  • Shared kernel functionality in its own library, which can be easily used in other projects.
  • Separates an existing Windows client in its own project, which uses a core library of functions.
  • A command line client has been created that uses a core library of functions. The command line client accepts its input both with command line parameters and with the help of a standard input stream, therefore it supports protocols.
0
source

All Articles