Mike Parks
Code.Where(c => c.IsTechnicalDebt).Refactor();

TFS 2010 Auto Shelve Extension

Wednesday, May 12, 2010 6:22 PM

We've been working with the Visual Studio 2010 SDK and the TFS 2010 SDK a lot recently to create new Visual Studio Extensions. You can find these extensions in the Visual Studio Gallery. If you're a developer/programmer, you should check it out, they have some pretty cool tools out there. I'd be surprised if you told me you went there and couldn't find any tools that could help you.

One of the new extensions Cory and I made is called TFS Auto Shelve. Check out the description and read about it below. If you're interested and you have VS 2010 w/TFS 2010, feel free to try it out and let us know what you think.

You can download it here: http://visualstudiogallery.msdn.microsoft.com/en-us/080540cb-e35f-4651-b71c-86c73e4a633d

 

Here's a description and screenshots:

Protect your code by guaranteeing your pending changes are always backed up to the TFS server.

 What it does:

  • Automatic Shelving shelves all your pending changes while you are coding
  • Manual Shelving shelves all your pending changes anytime with a single menu click or Ctrl+T hotkey
  • Uses one shelveset per workspace to shelve all pending changes to the TFS Server
  • Shelvesets are re-used to save the latest version of pending changes

 Functionality:

  • Automatic Shelving
    • Begins when any solution mapped to TFS is opened in Visual Studio
    • Disabled when non-mapped TFS solution is opened
    • Team Menu allows you to turn on/off automatic shelving
      • Team Menu -> TFS Auto Shelve (Running)
      • Team Menu -> TFS Auto Shelve (Not Running)
  • Manual Shelving
    • Can be triggered any time as long as you are connected to TFS
      • Team Menu -> TFS Auto Shelve Now
  • Options
    • Tools Menu -> Options -> TFS Auto Shelve Options
      • BaseName – This name is automatically followed by the workspace name to create a unique shelveset name. By default it’s “TFS Auto Shelve”.
      • TimerSaveInterval – The interval (in minutes) which automatic shelving will occur

 Helpful Info:

  • To view shelvesets, open Source Control Explorer, click on:
    • File > Source Control > Unshelve Pending Changes
  • Workspaces can be modified by:
    • Opening the Source Control Explorer > Clicking on Workspaces drop down > Click Workspaces… > Click Add/Edit/Removed
  • Custom Visual Studio Activity Logging is implemented. If you run into any errors, please startup Visual Studio with the /log switch, re-create the error, then close Visual Studio. You can browse to “%AppData%\Microsoft\VisualStudio\10.0\ActivityLog.XML” to view the log. Please feel free to inform us of any errors you see and we can work it out via email.

 

Thanks!

- Mike




Feedback

# re: TFS 2010 Auto Shelve Extension

Would be nice if it would be possible to configure a a number of automatically created shelvessets to keep.

Setting: Keep 10 shelvesets
Interval: 5 Minutes

Every 5 Minutes a new shelveset is created as long as 10 shelvesets are not reached. If 10 sehlvesets are existing then overwrite the oldest of the 10 shelvesets. And so on. This way the developer has more time to react to mistakes he made. 7/28/2010 8:39 AM | Jens

# re: TFS 2010 Auto Shelve Extension

Thanks for the tip Jens. We actually had a few more ideas like that on this one but haven't had time lately to implement them. Someone else told me an idea like this a while ago on another blog post I put up but this was implemented using a batch file. This might be a temporary work around if you want to use something like this. Check it out, here's the link (read his comment on the bottom as well):

http://geekswithblogs.net/MikeParks/archive/2009/09/15/tfs-auto-shelving.aspx 8/2/2010 11:32 AM | Mike Parks

# re: TFS 2010 Auto Shelve Extension

We often work with multiple Visual Studio instances to work on multiple solutions. The Auto Shelve does not keep them apart so the autoshelve is of no use this way. Can you make an option to add the solution name to the shelveset? 8/20/2010 7:40 AM | Marcel de Kleine

# re: TFS 2010 Auto Shelve Extension

Marcel, auto shelve actually will shelve all pending changes in any solution at the highest level of the TFS Workspace you set up locally. We actually haven't coded it to shelve at a solution level. If we get a chance, we'll try and throw an update in to have an option to shelve at the solution level. 8/23/2010 7:45 AM | Mike Parks

# re: TFS 2010 Auto Shelve Extension

I am having is an issue that "TFS Auto Shelve (Running)" menu item is disabled, but the "TFS Auto Shelve Now" is working. Anyway to get the running option enabled? 9/22/2010 3:52 AM | Jon

# re: TFS 2010 Auto Shelve Extension

Try opening up a solution that is currently under TFS Source Control. We made it so it only runs when you have a solution under TFS Source Control opened so it's not constantly running when no changes are being made. We threw in the shelve now feature in case you opened up an individual file from source control without opening a solution and wanted to auto shelve at that point. But yeah, once a solution under TFS source control is opened then the option should be enabled. 9/22/2010 8:05 AM | Mike Parks

# re: TFS 2010 Auto Shelve Extension

The projects that I have open are under TFS Source Control. The funny thing is that the two computers that I use, one works fine and the other doesn't. The solution file is the exact same one, cause I use dropbox to sync the solution file between both computers, but dropbox does not sync the source files. Then each computer has it's own workspace which places the source files relative to where the solution file is located.

I have tried reinstalling, but nothing changes. Any other ideas? 9/23/2010 4:00 PM | Jon

# re: TFS 2010 Auto Shelve Extension

It has something to do with the way your workspace is mapped on the computer that it's not working on. We use this method to determine if the current solution you opened up is under source control or not by passing the path as a string:

http://msdn.microsoft.com/en-us/library/bb139693.aspx?appId=Dev10IDEF1&l=EN-US&k=k%28MICROSOFT.TEAMFOUNDATION.VERSIONCONTROL.CLIENT.WORKSTATION.GETLOCALWORKSPACEINFO%29&rd=true

It's a Microsoft TFS DLL, so there shouldn't be a problem with the code since there's not much any logic to it besides passing in the path and getting a value back. It's probably coming back as NULL in the code so it's not enabling the menu option. So open Visual Studio up and click on File > Source Control > Workspaces > Edit, on the computer that it's not working on and check the paths to make sure they match the same paths as the computer that is working. Let me know how it goes. 9/24/2010 8:03 AM | Mike Parks

# re: TFS 2010 Auto Shelve Extension

That was the issue. The mapping was on level deeper on the computer working then the one that was not. For example:

Working Computer Mapping was:
$/ C:/.../Project/

The non-working computer mapping was:
$/SourceProject C:/.../Project/SourceProject

I changed the workspaces to match the first mapping and all worked. Thanks for the help! 9/28/2010 3:44 AM | Jon

# re: TFS 2010 Auto Shelve Extension

Cool, glad I could help. 9/28/2010 7:58 AM | Mike Parks

# re: TFS 2010 Auto Shelve Extension

I am running VS 2010 Ult Trial, and I installed TFS Auto Shelf, but everytime I try to do it manually or I think when it tries to do it, it says "TFS Auto Shelve shlved 0 pending changes" I made changes and even when I go to "check-in" it shows those changes available. Thoughts? 2/24/2011 11:17 AM | Reece

# re: TFS 2010 Auto Shelve Extension

Honestly I'm not sure Reece. I did look at the code but I don't see anything that stands out on why it wouldn't be working. I didn't do any testing with VS 2010 Ultimate Trial Edition though. It might just be a limitation on caused by the trial that's stopping the Microsoft.TeamFoundation.VersionControl.Client.PendingChange classes GetPendingChanges() to not function correctly. Are you using TFS 2010 or TFS 2008? That'll probably make a difference in the way it works as well. 3/3/2011 7:46 AM | Mike Parks

# re: TFS 2010 Auto Shelve Extension

Mike,

This is an excellent tool, so much so that I have recommended that our entire team uses it but it only seems to work for one other member.

For those that it doesn't work they too receive a "TFS Auto Shelve shlved 0 pending changes" message as Reece and I just received it too but it has subsequently updated the shelve sets.

I am running VS2010 Ultimate on Win7 and my colleagues are running VS 2010 Premium on a range of Windows OSes from WinXP to Win7 and Win2k8.

Any thoughts and help will be much appreciated.

Thanks. 3/3/2011 4:16 PM | Gurb

# re: TFS 2010 Auto Shelve Extension

Thanks Gurb, the Windows OS shouldn't make a difference. The extension is set up to run for Ultimate, Premium, and Professional so that shouldn't be the problem either. Try restarting Visual Studio after installing it, checking out a file from TFS, editing it, then running the manual shelve feature in this extension and see if it shows up as a shelveset. If you could give me a more detailed description of the steps I need to take to reproduce it I might be able to narrow down what the problem is. 3/10/2011 10:07 AM | Mike Parks

# re: TFS 2010 Auto Shelve Extension

I just installed the extension because I love the idea...but I can't seem to get it to run. Even the "TFS Auto Shelf Now" option does nothing. It says TFS Auto Shelve shelved 122 pending changes...but they don't appear when I go to File>Source Control>Unshelf... and search for my user.

I can still manually shelf changes using Visual Studio itself.

I'd love to get this working, if you have any advice.

I'm on Windows 7 SP1, VS Ultimate SP1.

Thanks!! 3/30/2011 6:00 PM | Mark

# re: TFS 2010 Auto Shelve Extension

Mike,

I am having exactly the same issue what Gurb is facing. We are 4 developers out of which it's working for only 1 developer and not working for the rest of the developers.

It's showing TFS AutoShelve shelved 0 pending changes.

We all are using TFS 2010 and VS 2010 ultimate edition. I tried Manual Shelving uisng Hot Keys and that too didn't work.

The native shelving of VS 2010 works though.

Thanks,
Partha
3/31/2011 11:17 AM | Partha Sarathi Maharatha

# re: TFS 2010 Auto Shelve Extension

Hey sorry about the late response. Cory is working on some updates to the Auto Shelve extension. We'll probably get them deployed soon. He did find some problems in the code so his updates should fix these issues. 4/22/2011 9:11 AM | Mike Parks

# re: TFS 2010 Auto Shelve Extension

Consider this another vote for developing a "keep the last n shelf sets" feature.

Thanks for building this!

- Mark 7/21/2011 11:11 PM | Mark Freeman

# TFS 2010 Auto Shelve Extension and Output window

Is it possible to turn off the output fro Auto Shelve? It keeps switching my VS output window to TFS Auto Shelve when I want it always to show the output from Debug. 10/4/2011 7:14 AM | Kevin Whitefoot

# re: TFS 2010 Auto Shelve Extension

Kevin, it's not currently possible. We were thinking about getting rid of the output. If we get some time we'll try and update it. 11/7/2011 9:36 PM | Mike Parks

# re: TFS 2010 Auto Shelve Extension

Hi Mike,

it seems you don't have time to continue in work on TFS AutoShelve.

I would ask you for source code to fix output window behaviour - it's really frustrating if windows of few visual studios randomly jumps to foreground while you're writing someting...

Of course I will share the fix:)

Thank you in advance,
Lukas 11/25/2011 4:11 AM | Lukas Sedlacek

Post a comment