Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I wrote this type of utility not too long ago and you are on the right track with what needs to be done.</p> <p>Here's some code to get you started. It should work for all .Net projects (VS 2003 - VS 2008) including deployment projects:</p> <pre><code>//get list of all files to be edited/removed SlnFiles = new List&lt;FileInfo&gt;(SelectedDir.GetFiles("*.sln", SearchOption.AllDirectories)); ProjFiles = new List&lt;FileInfo&gt;(SelectedDir.GetFiles("*.*proj", SearchOption.AllDirectories)); VssFiles = new List&lt;FileInfo&gt;(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)); </code></pre> <p>Deleting VSS files</p> <pre><code>//Delete all vss files VssFiles.ForEach(vss =&gt;{vss.Delete();}); </code></pre> <p>Editing sln files</p> <pre><code>//Edit sln files SlnFiles.ForEach(sln =&gt; { 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(); }); </code></pre> <p>Editing proj files</p> <pre><code>//edit proj files ProjFiles.ForEach(proj =&gt; { 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 = "\"*&lt;*Scc.*?(&gt;|\\W=\\W\").*?(&gt;|\")"; 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(); }); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload