Remove Source Control Bindings from Visual Studio Solutions and Projects


Ever need to share your Visual Studio solution or projects with someone?

The Problem

You ZIP up a folder with your code and send it. If your project is under source control – one that is integrated with Visual Studio – you will likely hear from the recipient of your code. They will be complaining that the get weird warnings from Visual Studio when they load the solution and projects.

The Need

What we need is a simple way to strip out all the source control bindings before we distribute the code.

The Solution: “VS Unbind Source Control”

I spend a few hours creating “VS Unbind Source Control” that automates these steps.

Download to tool or examine the source code here: https://github.com/saveenr/VS_unbind_source_control

Using the Tool

More details are at the GitHub site, but the short summary of usage is this.

  • Copy your solution to a new directory (because the tool does modify files)
  • Run this command: VSUnbindSourceControl.exe d:\myfolder
  • Once the tool is finished, all the source control bindings have been removed from any SLN files and from any *PROJ (CSPROJ, etc.) files.

Comments (2)

  1. Quilley says:

    I've been trying to run against a web site (not application) solution and get the regex error below.  Any advice?

    Microsoft Windows [Version 6.1.7601]

    Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

    C:Usersnicholas.mcquillen>VSUnbindSourceControl.exe C:ASM_DEVMEBPREPMainTE

    ST

    Starting

    Modifying Solution: C:ASM_DEVMEBPREPMainTESTMEBPREP.sln

    Unhandled Exception: System.ArgumentException: parsing "GlobalSection(.*Version.

    *Control" – Not enough )'s.

      at System.Text.RegularExpressions.RegexParser.ScanRegex()

      at System.Text.RegularExpressions.RegexParser.Parse(String re, RegexOptions o

    p)

      at System.Text.RegularExpressions.Regex..ctor(String pattern, RegexOptions op

    tions, TimeSpan matchTimeout, Boolean useCache)

      at System.Text.RegularExpressions.Regex.IsMatch(String input, String pattern,

    RegexOptions options, TimeSpan matchTimeout)

      at VSUnbindSourceControl.Program.ModifySolutionFile(String filename)

      at VSUnbindSourceControl.Program.Main(String[] args)

  2. Saveen Reddy says:

    @Quilley – thanks for reporting this. Can you please email me (saveenr@microsoft.com) your SLN file? I'll take a look at what is going on here.