Working "Offline" under Team System

Team System is a server-oriented source control system. When you check out a file, the client queries the server at the time of checkout. Ditto for rename, delete, etcetera. Obviously, this presents a huge problem if you're disconnected from the server. There's no server to check with!

Does this mean work grinds to a halt on your local workstation if your network or internet connection to your Team Foundation Server goes down?

Well, not quite, but it does become a little more labor intensive.

If you're planning to go on a trip, or you have some other scenario where you know you'll be disconnected from the server at a specific time, you could check out the entire solution prior to going offline. Since Team System uses shared checkouts, this isn't as bad as it sounds. But it's still kind of a chore, and you have to remember to do the checkout while you still have server connectivity.

If you forget to do a full checkout-- or in the unfortunate event of a network outage-- you can still get work done, but you need to be careful how you do it.

  • Obviously, you'll need to turn off source control in the IDE. You certainly don't want a server query to a nonexistent server every time you start editing a file. That'd be painful!
  • Remove the read-only flags from the files you edit. All files under TS version control are marked read only by default until they're checked out from the server. We have no server to connect to, so we have to do this ourselves. The IDE will prompt you to do this as you edit files, so you don't have to do it manually.
  • Avoid renaming files. It's difficult to tell a rename from a delete (of old name) and add (of new name) without additional context provided by the command. So avoid the problem by avoiding renames.

Now the good news. The Team Foundation Power Toy (tfpt) has an "online" command which makes this process a little easier.

If you've worked offline, you can execute

tfpt online

in the local filesystem folder, and the power toy will do the rest. Note that it does not pick up deletes by default, because that incurs a lot of extra server traffic. If you deleted files, be sure to run

tfpt online /delete

To pick up your deletes as well.

After the tool runs, all your edits, adds, and deletes (but NOT renames) will be added as pending changes. It's up to you to check in your changes.

That's typical usage; here's the complete command-line reference for the tfpt online command:

When away from the network you may edit files without pending the necessary
changes to the server. tfpt online pends edits, adds, and optionally deletes to
files you have changed. You should not rename files when offline.

Usage: tfpt online [/deletes] [/adds] [/noprompt [/preview] [/nuke]]
                   [/exclude:filespec1,filespec2,...] [filespec...]
                   [/recursive]

 /adds          Checks with the server to see if any files in your
                        workspace are new and pends adds
 /deletes               Checks with the server to see if any files in your
                        workspace have been deleted and pends deletes
 /noprompt              Operate in command-line mode only
 /exclude:filespec...   Files and directories matching a filespec in this list
                        are excluded from processing
 /recursive             Switch from one level of recursion to full recursion
 filespec...            Only files and directories matching these filespecs
                        are processed

Options usable only in /noprompt mode:
 /preview               List the files and changes to which changes will be
                        pended without making changes
 /nuke                  Instead of pending changes to the matching files not
                        currently in version control, deletes them from disk

You have to download the giant Visual Studio 2005 SDK (~300mb), which is still in beta at the time of writing, to get a copy of the TFPT utility. For convenience's sake-- and to avoid a giant, unnecessary download-- I am temporarily hosting a local copy of the TFPT tool and documentation here (308 kb) for anyone who needs a copy.

posted on Monday, July 03, 2006 4:27 PM by jatwood

Comments

# re: Working "Offline" under Team System

"Well, not quite, but it does become a little more labor intensive.". Well, I'd disagree with that; The guidelines you provide are correct and are probably the safest bet right now, but the truth is they are a prett ugly (and risky) hack, at best. TFS just isn't the right source control solution if working offline is a significant requirement (which it is for a lot of people). Frankly, I was very surprised (and disappointed) that MS would go ahead and keep that pretty nasty "feature" from VSS on TFS :(
Monday, July 03, 2006 6:34 PM by Tomas Restrepo

# Praca "offline" z Team System

Czasami zdarza się, że zabieramy kod (lub komputer o ile mamy przenosny) z pracy do domu aby popracować...
Tuesday, July 04, 2006 8:47 AM by Lazy Developer - Ziemowit's weblog

# VSTS Links - 7/5/2006

Dave McKinstry on ASP.NET 1.1 projects with Team Foundation Version Control , Understanding ChangeSets...
Wednesday, July 05, 2006 9:18 PM by Team System News

# Mit TeamSystem SourceControl offline arbeiten

Wednesday, August 16, 2006 10:46 AM by artiso Blog

# re: Working "Offline" under Team System

It is just plain painful to work offline with TFS, no matter how you cut it. While these tools can work around the lack of integrated offline support, they are bad in the sense that you have to download these tools to solve a problem that could have been (arguably) addressed as a product feature from the beginning, plus the overall user experience is just ugly...

Thanks for the command line switch reference. Too bad there isn't an "include" option to specify a filespec - all too often I get way too much detected as new/modified, and maintaining the exclude list is more trouble than simply specifying what I what to include in the first place.
Monday, November 27, 2006 7:16 AM by Paul Laudeman

# TFS a práce offline

Začali jsme v jednom projektu používat TFS a velmi mě překvapilo, když jsem se dozvěděl, že TFS nepodporuje
Friday, November 09, 2007 10:49 AM by ernestovo zákoutí

# TFS a práce offline

Začali jsme v jednom projektu používat TFS a velmi mě překvapilo, když jsem se dozvěděl, že TFS nepodporuje
Tuesday, November 13, 2007 7:52 AM by ernestovo zákoutí