105

Our TFS server has some temporary connectivity issues right now, and as such VS has gone unresponsive, leaving 50+ developers unable to work!

Is it possible to switch TFS into an offline mode in the event of such an issue?

abatishchev
  • 98,240
  • 88
  • 296
  • 433
MPritchard
  • 7,031
  • 7
  • 28
  • 40
  • If the OS is still responsive, the fastest way to make VS offline is to open Network Connections, then Disable the connection, then Enable. Surely this is not "convenient" if you are remotely working :) – U and me Oct 27 '12 at 18:26
  • It's possible to unbind an individual project, instead of the entire solution. – samus Aug 28 '18 at 20:29

9 Answers9

80

See this reference for information on how to bind/unbind your solution or project from source control. NOTE: this doesn't apply if you are using GIT and may not apply to versions later than VS2008.

Quoting from the reference:

To disconnect a solution or project from source control

  1. In Visual Studio, open Solution Explorer and select the item(s) to disconnect.

  2. On the File menu, click Source Control, then Change Source Control.

  3. In the Change Source Control dialog box, click Disconnect.

  4. Click OK.

tvanfosson
  • 524,688
  • 99
  • 697
  • 795
  • 1
    Thanks. The painful part was waiting for the connection to time out to let me into VS! – MPritchard Jun 01 '09 at 13:52
  • The benefit is that it remains "bound", but disconnected so you just have to reconnect rather than rebind everything. It automatically checks for any modifications that occurred while disconnected, and performs the appropriate actions (check out, etc.) – GalacticCowboy Jun 01 '09 at 13:53
  • 10
    @MPritch - you can speeds this up by adding an entry to your hosts file, pointing your TFS server to 127.0.0.1. This causes it to fail fast, so you can then use tvanfosson's suggestion. Don't forget to remove the hosts entry though :) – Rob Levine Jul 12 '10 at 10:06
  • 22
    The "Disconnect" button is disabled for me. Had to close and open it again ... this put everything in offline mode. – micahhoover Sep 14 '11 at 20:52
  • 5
    For VS 2012RC+ Step 2.On the File menu, click Source Control, <> then Change Source Control. 3. Select Unbind – RickAndMSFT May 24 '12 at 00:17
  • 15
    It's easier if you can close VS, then re-open the .sln file directly from your PC. Then choose "Yes" when VS asks if you would like to work offline because cannot connect to TFS. – U and me Sep 08 '12 at 01:01
  • @RobLevine What would the entry in hosts file look like? `tfs-server 127.0.0.1`? – countunique Jul 30 '13 at 20:18
  • @user19192 - yes, that's it. – Rob Levine Aug 01 '13 at 08:19
  • Is it possible to repeat all 4 steps via script or macros? – bulatzamilov Mar 20 '14 at 13:52
  • This solution indeed does not apply to VS2010 nor higher. – Bora Aug 07 '14 at 08:03
  • Select, "TEAM > Disconnect Team Fondation Server" menu. Reopen solution in project folder... – aslanpayi Dec 22 '14 at 21:10
47

The 'Go Offline' extension adds a button to the Source Control menu.

https://visualstudiogallery.msdn.microsoft.com/6e54271c-2c4e-4911-a1b4-a65a588ae138

Milan Jaros
  • 1,107
  • 17
  • 24
13

plundberg: The "disconnect" button is only available for the TFS provider starting in VS 2008. Even then, I'm not sure if it's officially supported. The recommended way to use the Go Offline feature is to [re]open the solution.

Martin Pritchard: if you get stuck mid-operation, you can force VS to timeout by pulling the network plug (literally) or running ipconfig /release.

Once you're marked offline, here's a step by step guide to working in that mode: http://teamfoundation.blogspot.com/2007/12/offline-and-back-again-in-vs2008.html

More detailed info on tweaking the behind-the-scenes behavior: http://blogs.msdn.com/benryan/archive/2007/12/12/when-and-how-does-my-solution-go-offline.aspx http://blogs.msdn.com/benryan/archive/2007/12/12/how-to-make-tfs-offline-strictly-solution-based.aspx

Richard Berg
  • 20,629
  • 2
  • 66
  • 86
  • 3
    +1'd for the ideas. Luckily I'm out of TFS hell now, and back using good old Subversion :) – MPritchard Feb 03 '10 at 09:41
  • Looks like the only way to force off-line mode is by unplugging your network cable. There is no "work off-line" button. – Remko Jansen Aug 26 '10 at 13:32
  • This seemed to work for me. This is a - for TFS and + for SVN. SVN works much much better when you're offline. – Mas Mar 03 '11 at 13:08
10

There are couple of little visual studio extensions for this purpose:

  1. For VS2010 & TFS 2010, try this
  2. For VS2012 & TFS 2010, use this

In case of TFS 2012, looks like there is no need for 'Go offline' extensions. I read something about a new feature called local workspace for the similar purpose.

Alternatively I had good success with Git-TF. All the goodness of git and when you are ready, you can push it to TFS.

rpattabi
  • 9,984
  • 5
  • 45
  • 53
3

Depending on which tool windows you have open, VS may or may not try to hit the team server automatically when it starts up.

For best results try this:

  1. Close all instances of visual studio
  2. Open an empty visual studio (no project/solution)
  3. See which windows are opened by default, if source control explorer or team explorer or any other windows that use team are opened (and activated) by default, close them or switch them to a background tab.
  4. Close visual studio

You should notice now that you can start visual studio without it trying to hit the TFS server.

I know its just an aside to your problem, but I hope you find this helpful!

TJB
  • 13,367
  • 4
  • 34
  • 46
3

If you have a solution open, and TFS is down, you might have trouble going into offline mode. If you close and reopen your solution, a nice little dialog will appear asking you if you want to Go Offline.

Alternatively if you don't want to close/reopen the solution, (as suggested by Bernie) you can install the TFS Go-Offline plugin, then click:

TEAM -> Go Offline
Community
  • 1
  • 1
demoncodemonkey
  • 11,730
  • 10
  • 61
  • 103
  • Well, I installed the "Go offline" plugin, restarted VS2013, selected the menu to go offline... but TFS still hangs forever when I try and open a project. Will this thing ever give up and timeout ..? Our TFS server is currently down, and I can't do anything in VS2013 as a result. ;-( – Mike Gledhill Jun 26 '15 at 07:23
2

Simply, change the root folder name for your solution in your local machine, it will disconnect automatically.

  • as an emergency fix this works quite well. For someone reason my project would not let me disconnect without unbinding first which i did not want to do. This though worked around it – Matrim Feb 05 '19 at 09:41
1

I just wanted to include a link to a resolution to an issue I was having with VS2008 and TFS08.

I accidently opened my solution without being connected to my network and was not able to get it "back the way it was" and had to rebind every time I openned.

I found the solution here; http://www.fkollmann.de/v2/post/Visual-Studio-2008-refuses-to-bind-to-TFS-or-to-open-solution-source-controlled.aspx

Basically, you need to open the "Connect to Team Foundation Server" and then "Servers..." once there, Delete/Remove your server and re-add it. This fixed my issue.

JonnyBasic
  • 11
  • 1
0

If the code has already been checked out by the user that if offline and they have the latest version on their local hd, then they just need to browse to the solution location and open the solution by double clicking sln file. The solution will open in disconnected mode.