TFS Offline Pending Changes in Visual Studio

In my current project there will be times where I'll need to work disconnected from our TFS server. If you've worked with TFS, you by no doubt know that all communication with TFS occurs over HTTP(S), which is fine and dandy when you're connected to the network, but of course creates issues when you're not. Unfortunately because of this, TFS doesn't really provide a native way to work in a disconnected mode, so you have to do a couple things to ease your frustration.

After some quick searching for how to handle offline changes in TFS, I quickly found this post that shows how to use the TFS Power Tool to do what I need. But I don't want to have to memorize yet another set of command-line parameters to do something that I should be able to do within Visual Studio. So allow me to make your life a *little* bit easier:
  1. Download and install the DSL Tools for VS 2005 Redistributable Components (it's a requirement for the TFS Power Tool, mainly for the Process Template Editor in case you're wondering).
  2. Download and install the TFS Power Tool.
  3. Open VS 2005, go to Tools and select External Tools.
  4. Click the Add button and enter the following:
    • Title: TFS Offline Pending
    • Command: The location tfpt.exe, which for me is C:\Tools\TFSPowerTools\tfpt.exe.
    • Arguments: This is where reading the previously mentioned blog post will help, but as a reference mine is "online /deletes /exclude:*.gpState,*.suo,*.vsmdi,*.user,bin,obj,TestResults" (without the quotes), which means that I don't care about any files that are of type .gpState, .suo, .vsmdi, and .user. Also notice how I excluded the entire bin, obj, and TestResults folders.
    • Initial Directory: This depends on how your solution/projects are structured, but for me it's simply $(SolutionDir).
  5. Uncheck "Use output window" and "Prompt for arguments". Check "Close on exit".
  6. Click OK. As a reference, this is what mine looks like:
TFS Offline Pending in VS External Tools

So let's say you are out of the office trying to make up some work over the weekend. You open your VS 2005 solution and of course you get an error saying that your TFS server does not exist or is not accessible. You have no choice but to click OK, which shows you another dialog that says the solution source control binding information can't be found. You click OK again only to receive the option to temporarily work uncontrolled or to permanently remove source control bindings. You make the correct selection to temporarily work uncontrolled, which finally opens your solution/projects so you can get some work done (remember that because all your files will be read-only, be sure to overwrite any files in which you are making changes).

The weekend is over, you made a number of code changes while disconnected, and now you want to get those changes into source control once you get back into the office. To do so follow these steps:
  1. Open your solution/project, which should connect automatically to your TFS server (but didn't automatically pick up your changes).
  2. In VS 2005, click Tools and select TFS Offline Pending.
  3. The TFS Power Tool command window will appear and then another window titled "Online" that looks something like this:
    TFS Offline Pending Changes
  4. The tool picked up all files with relevant change types, although in this case I only care about the couple of files that are of type "edit".
  5. Now click the Pend Changes button. This will make the Online window and the command-line window go away.
  6. Right-click your solution/project and select View Pending Changes. If nothing shows up, click the Refresh button.
  7. And now you're good to go. From here you can check-in your pending changes and you're off on your merry way.
And that should do it. I know it's a couple extra steps, but at least you can do it all from within VS 2005. I've been working this way for the last couple weeks and it's worked as expected with no problems. Quite painless actually. Enjoy.
Print | posted on Friday, June 15, 2007 10:57 AM

Feedback

# re: TFS Offline Pending Changes in Visual Studio

Gravatar left by Jim Holmes at 6/26/2007 5:52 AM
Great stuff, Dave, and right in time!

FWIW, I'm using a local Subversion repository to capture changes on a more granular level while I'm offline. I'm averaging home office work once a week or so, and I severely dislike working on features for an entire day without having any safety net of working bits checked in as I iterate through tasks.

# Links (6/26/2007)

left by Member Blogs at 6/26/2007 10:21 PM
.NET Switch Statements with Enums best practice Validation with Enterprise Library 3.x Iterate through
Comments have been closed on this topic.