Tip of the day: Getting Visual Studio with TFS to work offline
31 August, 2011 3 Comments
Earlier to day our TFS server went down. Visual Studio likes to have a constant connection open to it, but obviously that wasn’t going to happen. Luckily, it is possible to work on a solution with no connection to TFS.
If you were just starting some work…
If Visual Studio was open when TFS went off-line then it won’t allow you to check out any files. If all your files are checked in already, then you can just shut down Visual Studio and then start again. When the solution opens it detects that TFS is gone and offers to open the project in Offline mode:
When TFS is available again you can simply reconnect to the server by selecting the Team?Connect to Team Foundation Server… menu. Once you are connected, you can right-click the solution and select “Go Online“.
You’ll get a dialog that asks to to confirm the files that you’ve changed in the meantime:
It will then take a few moments for TFS to catch up (I have quite a large solution, so it took about a minute for me) then the files appeared in the Pending Changes window ready to be checked in as normal.
If you were in the middle of something
If you already had files checked out when TFS went offline then this post about converting to offline may be more useful to you.
There is also a Visual Studio extension, if you prefer not having to restart Visual Studio called Go Offline. Once installed, just to to File?Source Control?Go Offline. This may be a more useful solution if you are constantly going in and out of connection with TFS (a mobile broadband connection on a train for example).