Dave Donaldson

Critical thinking in software development

Search

Advertisement

Subscribe

My Tweets

  • @willburrus Haven't seen your email. Sorry, thought you would have seen mine earlier.
  • @hkarthik I can't get my avatar to look quite like me. Need to spend more time with it I guess.
  • Listening to new G 'N R album early on their MySpace page (http://www.myspace.com/gunsnroses). Still formulating an opinion.

TFS Offline Pending Changes in Visual Studio

Friday, June 15 2007

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:
TFSOfflinePendingVSExternalTools

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:
    TFSOfflinePendingChanges
  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.

Similar Posts

  1. TechEd 2005 Recap
  2. Web Service Proxy Generator (WSProxyGen)
  3. NHibernateRepository

1 comment(s) so far

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.

Post your comment

Comment