Skip Ribbon Commands
Skip to main content

Resources

:

Using TFS: How to disconnect a solution from TFS

Comp410 Resources
​​​

How to Disconnect a Solution from TFS

There are a number of reasons for disconnecting a Visual Studio solution from TFS: 

  • You are making a backup for archival purposes
  • You are moving the source code to a new repository server

 

It is important to understand that Visual Studio/TFS puts entire folder trees ("workspaces") under source control.   Simply unbinding a solution from TFS does not fully remove it from source controll.

 

Get a clean copy of your code

During the development process, it is very common for the application to get tied to and rely on hard-coded local files and resources that are not represented in source control.  Bottom line: Everything for a solution must be in directory tree below the solution folder and everything must appear in the solution and team explorers. 

In such, it is imperative to get a "clean" copy of your code before archiving it.    Basically, one needs to download and test a version of the code from TFS into a new workspace, hopefully breaking any links to uncontrolled local resources.

  1. Close any open solutions in VS
  2. Create a new workspace: File/Source Control/Advanced/Workspaces...
    • Click Add... and provide the new name and location
  3. Download the code into the new workspace:  File/Source Control/Advanced/Open from Source Control...
    • Be sure to select the workspace you just made.
  4. Thoroughly test your application before proceeding.

 

Unbinding the solution from TFS

This will break the connection between the solution and TFS.   Note that the workspace (directory tree) where the solution is located is still under source control!

  1. Open the desired solution
  2. Unbind the solution from TFS:  File/Source Control/Advanced/Change Source Control...
    1. Select one project at a time (sorry, VS does not enable multiple selections here).
    2. In Visual Studio 2015 Enterprise, after you clicked on "Change Source Control...", in the popup dialogue window, click "Unbind", see another popup window asking you whether you want to unbind the project, then say yes. Now you have unbinded one project from TFS. Continue clicking "Unbind" and select "Yes" till the "Unbind" button becomes "Bind" button. 
    3. Click "Unbind"
    4. When done, click OK
  3. Copy the entire solution directory tree to a new location.
  4. Zip up the copied solution folder.

 ​

Alternate Unbinding (yay linux)

This method is NOT recommended as it is extremely dangerous to delete or modify solution and project files by hand!   If the above technique does not work, you should first investigate why it is not working (e.g. are some project not loading because VS is incorrectly configured?) and fix those issues first.   This technique should only be used as an absolute last resort.  

In fact, this method does not fully disconnect the solution from TFS, as it leaves source control information still in the solution and project configurations.   Visual Studio will complain that it thinks the solution is still connected to source control but doesn't know where.

  1. Navigate to the root of the directory after right-clicking on the project in TFS and downloading the archive of the project.
  2. Run the following commands in your terminal, these will remove the visual studio leftover files that might refer to the TFS server, 
    1. find . -name "*.vspscc" | xargs rm
    2. find . -name "*.vssscc" | xargs rm
  3. ​The above commands feed the files found (the ones with the .vs*) extension to rm, if you switch that command to echo, then you'll see what it's doing.
  4. ​In your base .sln file, remove the following section

 

GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 46
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
SccTeamFoundationServer = http://tfs2015.cs.rice.edu:8080/tfs/comp410
                (... other sections elided)
EndGlobalSection

 

 

Home