SCC Removal Tool for TFS / Visual Studio

Preface

Publishing sample code to the blog requires some manual tasks to remove all the source control configurations and files as well as the user specific files of Visual Studio.

After publishing a few code samples, having to do the same changes manually again and again, I thought it was time to create a tool doing this for me. Of course, taking the time I needed to build that tool, I could have published a few more code samples. But it is much more fun to write a tool than to do the same thing again and again 😉 And of course, having a tool makes sure I will not forget a step.

The primary intention is to disconnect the solution from source control. I don’t like samples downloaded from the internet where the first thing that happens is, that VS complains it cannot connect to the source control. Beside removing the SCC footprint, the tool also deletes all the output. I think the output is not needed when the source code is delivered.

This tool is created based on the usage of TFS 2012 und Visual Studio 2012. So maybe, when using older versions of VS or other version control systems, this tool might not remove all the SCC footprint.

SCC Files To Delete

TFS creates a .vssscc for each solution and a .vspscc file per project. The tool searches for these files in the working directory and its subdirectories and deletes them.

Disconnect From Source Control

The solution file .sln file contains some information about the source control system where the code is stored. All this is configured inside GlobalSection(TeamFoundationVersionControl). The whole section needs to be removed to disconnect the solution from source control.

The project file .csproj (suffix of C# projects) also contains some SCC footprint. Every line starting with >Scc needs to be removed too.

User Files To Delete

Visual Studio stores user-specific information related to the solution in .sou files. User-specific information related to the project are stored in .user files. The tool deletes all of these file types in the working directory and below.

Directories To Delete

By default, the output of a project is written to bin and obj directories, which are located below the project directory. All directories with these names are deleted. You can enter additional directory names in the “Remove Directories” field. I use this because I change the output for all configurations to “.\Output” by default.

And for those of you who create unit tests: the TestResults directories are included in the list of default directories too.

Configuration Abilities

The tool reads the default file types and directories to be deleted from the app.config. So in case you like to change these values, just edit the file. The tool also stores the values entered (working directory and additional directories to be removed) into the app.config.

The SCC footprint detection of the solution and project files is hard-coded. So in case you need some changes here, you have to change the code.

Maybe Incomplete

Yes, the tool might be not be complete. There are several reasons for this: C# is the preferred programming language in my company. So maybe some language-specific files or settings are not covered by the tool.

Also, we do create only a small subset of applications types, like WPF, Windows services, … So maybe SharePoint or Office projects look different. Again, if you need to cover these project types and the tool does not: you have the code, so change it.

Not To Be Forgotten

The software is provided “as is”, without warranty of any kind, expressed or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and non-infringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.

Be careful!

The source code can be found here.

SCC Remover Screenshot