246

I have a solution that contains a good deal of projects,

I would like to remove the source control bindings completely, how can I do this?

Update: What I really want to do is move one solution and its projects from TFS 2005 -> 2008. Thats why I am removing the bindings, is there a better way to do this?

Bert Huijben
  • 19,525
  • 4
  • 57
  • 73
Michael L
  • 5,560
  • 7
  • 29
  • 32
  • I don't think you have to remove and re-add the bindings to upgrade to a newer TFS. The 2008 client fully replaces the 2005 client and works in VS 2005 and 2008 for old and new servers. – Bert Huijben Feb 06 '09 at 12:00
  • 2
    I created a VSIX addon that removes TFS bindings and zips up a copy of your solution (also removes all unnecessary files). See http://visualstudiogallery.msdn.microsoft.com/eb5d5d7d-f67e-4076-8fd0-23f36976deff – RickAndMSFT Sep 04 '14 at 01:22
  • empty Models folder got messed up @RickAnd-MSFT I had to delete and recreate it otherwise it works great. thx – Tom Stickel Aug 29 '15 at 00:04
  • @RickAnd-MSFT that should probably be an answer – Chris Marisic Dec 07 '15 at 17:44

14 Answers14

270

File -> Source Control -> Advanced -> Change Source Control and then unbind and/or disconnect all projects and the solution.

This should remove all bindings from the solution and project files. (After this you can switch the SCC provider in Tools -> Options -> Source Control -> Plug-in Selection).

The SCC specification prescribes that all SCC providers should implement this behavior. (I only tested it for VSS, TFS and AnkhSVN)

Matthew Lock
  • 13,144
  • 12
  • 92
  • 130
Bert Huijben
  • 19,525
  • 4
  • 57
  • 73
  • 4
    +1, but unfortunately this still keeps the elements in the project files, as well as keeps the .vssscc files. However, the solution file is cleaned. Used VS 2010 Pro, with this being the first TFS project we've ever used. – James Skemp Dec 12 '11 at 19:57
  • 28
    This assumes you can connect to the original TFS server. – ATL_DEV Nov 19 '12 at 04:23
  • 2
    I created a VSIX addon that removes TFS bindings and zips up a copy of your solution (also removes all unnecessary files). See http://visualstudiogallery.msdn.microsoft.com/eb5d5d7d-f67e-4076-8fd0-23f36976deff – RickAndMSFT Sep 04 '14 at 01:22
  • My TFS workspace has been remove due to inactivity (probably). But I was still able to remove bindings. However, it didn't work the first time. The second time I checked all bindings were still there. The second time I unbound everything it worked though. – DerpyNerd Aug 27 '16 at 11:11
155

I have no File -> Source Control menu in Visual Studio because I've never used TFS with this installation of Visual Studio.

My problem was I was opening a solution from the internet and the original author had forgotten to remove the TFS bindings, so every time I open the solution I'd get an annoying popup saying

"Go Offline

The Team Foundation Server http://some-other-guys-tfs-server/ 
is currently unavailable.

The solution will be opened offline."

To get rid of this, I deleted the .suo next to the .sln file, and then opened the .sln file in Notepad and deleted this entire section:

GlobalSection(TeamFoundationVersionControl) = preSolution
    SccNumberOfProjects = 2
    SccEnterpriseProvider = {xxxxx}
    SccTeamFoundationServer = http://some-other-guys-tfs-server/
    SccLocalPath0 = .
    SccProjectUniqueName1 = xxDemo\\xxDemo.csproj
    SccProjectName1 = xxDemo
    SccLocalPath1 = xxDemo
EndGlobalSection

Save the .sln in Notepad and then open in Visual Studio, problem solved.

Update: Saveen Reddy has created a tool to do this. I haven't tried it though.

saveenr
  • 8,439
  • 3
  • 19
  • 20
Matt Frear
  • 52,283
  • 12
  • 78
  • 86
  • 3
    That was it, I had this popup too. Thanks. But if I removed the .suo file and start VS I lost my opened files history. Moved the .suo file back, I got my opened files back. So I needed just remove the section. – ibram Jul 24 '12 at 07:05
  • I had a project that was in VSS added to TFS, and VS kept seeing VSS as the source control provider (even though I removed the bindings, which is admittedly a somewhat separate issue). Deleting the above code in the project and re-binding to TFS solved the problem. – 333Mhz Jul 24 '12 at 21:23
  • I was having trouble until I deleted my .suo file. Only then did it ask me if I wanted to permanently remove the source control bindings. – zacharydl Sep 02 '14 at 16:17
  • In this day and age, we need to do this for this simple and common task? Microsoft should think about usability... – Damn Vegetables Jan 13 '15 at 17:40
  • I went through the Sourcecode of the Tool and the part that was causing the TFS connection was everything in the *.csproj starting with – CodingYourLife Jan 25 '16 at 12:34
  • Works well with VS 2015. – Kishore Feb 29 '16 at 23:07
  • 1
    Worked great with VS 2015, only need is removed TFS section in .sln file – Tony Dong Sep 08 '16 at 19:29
42

The simplest solution would be to open Visual Studio, deactivate the TFS Plugin in Tools > Options > Source control and reopen the solution you want to clean. Visual Studio will ask to remove source controls bindings

Johan Buret
  • 2,614
  • 24
  • 32
  • 1
    Also I forgot to mention, this is a VS 2008 Solution, and I think your answer only works with VS 2005. – Michael L Dec 11 '08 at 11:00
  • 1
    Have tried many different solutions, but this seems to be the simplest and fastest (in Visual Studio 2012). Have worked so far on the solutions I have! – olf May 31 '13 at 13:38
  • Awesome! It's fast, it's simple, it's exactly what I need to clean a project from all TFS bindings. – Andreas Feb 18 '14 at 12:10
  • Had tried to remove the binding in the solution-filen and delete the sourcecontrol-files in the projects but VS still wanted to connect to tfs. But this one worked :) – Michael Olesen Jun 10 '14 at 23:09
  • 3
    This doesn't seem to work in 2013 - the Source Control Plugin is stored in the solution. – Rob Sep 09 '14 at 04:55
  • 1
    This worked great for me in VS2013 Ultimate. I was moving a single solution from TFS to SVN and this saved my bacon. – Rob Horton Oct 01 '14 at 21:08
  • Worked perfeckly in VS13 Professional. It even asked me if I wanted to remove TFS binding completely from the solutions. That's what I wanted. I closed VS and open it again, and activated TFS again and reopen and it's dependency is gone. Great work @Johan Buret +1! – radbyx Jan 11 '15 at 11:02
  • Didnt work for me in VS2013. I disable it but when I reopen the project it reenables the damn plugin! – Piotr Kula Feb 04 '15 at 11:51
  • Didn't work for me in VS 2015 Community. As soon as I opened the solution it gave the same "this project is bound to source control" prompts. – Brady Sep 16 '15 at 21:48
12

If anyone needs to do this outside the context of the Visual Studio application - via command-line for example, I wrote a small tool which will strip the source control bindings from Solution And Project files. The source is available here: https://github.com/saveenr/VS_unbind_source_control

saveenr
  • 8,439
  • 3
  • 19
  • 20
  • Sorry but this didn't work for me. It kept asking if I wanted to disconnect from the new server and reconnect to the old server. – ATL_DEV Nov 19 '12 at 04:24
  • 1
    Nice little tool. I just converted our companies repository from TFS to SVN and those messages were pesky. BTW, ran this against solutions built in VS2019 with no issue and it worked with 2015 , 2017 as well. I made a small change to better list solutions/projects that failed the process. If you have A LOT of projects to convert they can be lost. – j.hull Nov 24 '21 at 17:03
6

Next works for me:

  1. Delete all .vssscc (solution binding) and .vspscc (project binding) files
  2. Remove block GlobalSection(TeamFoundationVersionControl) = preSolution from solution file

There could be also information regarding source control in the proj file in tags

<SccProjectName>SAK</SccProjectName> <SccLocalPath>SAK</SccLocalPath> <SccAuxPath>SAK</SccAuxPath> <SccProvider>SAK</SccProvider>

SAK states for "Should Already Know", so it can be kept.

ASpirin
  • 3,601
  • 1
  • 23
  • 32
5

Old post, so just adding to the answers of @Matt Frear and @Johan Buret. Both work.

But in Matt's case, you also need to set these (VS 2012) in Notepad/text editor:

SccProjectName = ""
SccAuxPath = ""
SccLocalPath = ""
SccProvider = ""

To each project in the solution file (.sln).

@Johan's answer effectively does this....

EdSF
  • 11,753
  • 6
  • 42
  • 83
4

Sometime, the binding info is cached

To clear Team Explorer's cache:

Go to C:\Users\<user>\AppData\Local\Microsoft\Team Foundation\2.0
Delete or rename the Cache folder.

This come from a website I could not find now. Thanks for that guy for the tip.

Mark
  • 41
  • 1
2

You could try using this tool which automatically removes the Team Foundation Bindings from a project. http://www.softpedia.com/get/Programming/Other-Programming-Files/Team-Foundation-Binding-Remover.shtml

1

I found this tool that helped me get rid of a tfs binding complitly its found here https://marketplace.visualstudio.com/items?itemName=RonJacobs.CleanProject-CleansVisualStudioSolutionsForUploadi

it creates a zip with the removed source binding without modifying the orginal project.

robgha01
  • 383
  • 4
  • 11
1

In visual studio 2015,

  1. Unbind the solution and project by File->Source Control->Advanced->Change Source Control
  2. Remove the cache in C:\Users\<user>\AppData\Local\Microsoft\Team Foundation\6.0
code4j
  • 4,208
  • 5
  • 34
  • 51
1
  1. Go to File -> Source Control -> Advanced -> Change Source Control (if change source control doesn't appear, click on solution in the solution explorer then try again)
  2. Unbind solution and all projects

Now right click on solution and you will see "Add Project To Source Control". if you want to add project to source control again you might be get some errors that ask you to change the solution folder on TFS. it happens because your solution has some mapping in a workspace yet. remove mapping or delete workspace. now your solution is completely unbind and unmapped from TFS or workspaces.

Ali Dehghani
  • 176
  • 1
  • 6
0

In VS2017

  1. go to Home in Team Explorer
  2. Click on Settings in project section
  3. Click on Repository Settings in Git section
  4. From next window see Remotes section. you will see option for remove

NB: I check that for git repository

reza.cse08
  • 5,938
  • 48
  • 39
0

The other option is

Delete the workspace

re-map when needed

Make sure to check, rollback (Undo Pending changes)

before you remove workspace

This is quickest and surest one

Good Luck

-1

Here you can find another tool (including source code) to remove both SCC footprint from the solution and project files and the .vssscc and .vspscc files. In addition, it removes the output and other configurable directories.

Hth

Stefan

Stefan
  • 67
  • 2