There’s a very nice list of utilities the Visual Studio 2010 Power Tools brings to the table. It would definitely benefit any developer using VSTS 2010 to get the power tools installed and bring themselves up to speed on the capabilities available.

However, there’s one particular nugget that is very helpful when it comes to projects that have a branching strategy in place. And that’s migrating shelves from one code branch to another in your repository. For more on proper branching strategies, see the on CodePlex.

Some of the power tools available are only available from the command line out of the box. This one falls into that category. So to start with, bring up a Visual Studio command prompt. The easiest way is to hit the Windows key and type “command” in the search box:

image

To see your available options and the nomenclature of the unshelve command, type in “tfpt unshelve /?”:

image 

Pretty simple and straightforward. But here’s a snip for you to copy/paste into the command line, just replace the tokens accordingly:

tfpt unshelve “<your shelveset name>”;<TFS Username> /migrate /source:”<serverPath>” /target:”<serverPath>”

Of course, I included the double quotes because more often than not, shelveset names as well as server paths have spaces in the text.

Here’s a sample with tokens replaced:

tfpt unshelve “Latest - Pre v1.0 to v2.0 Branch Migration”;joedeveloper /migrate /source:”$/trunk/v1.0/Source” /target:”$/trunk/v2.0/Source”

It’s that simple. However, there’s one caveat: You may receive an error telling you, “Unable to Determine the Workspace”. The easiest way around this is to run the unshelve command directly from one of your local directories that’s mapped to your local drive. In my case, I typically just run it from the source directory that’s mapped to the source server path. So in the above example, I would navigate to the “C:\Projects\MySoftware\trunk\v1.0\Source\” directory from the VS command line before running the unshelve command.

From there, you’ll receive dialog prompts similar to those in Visual Studio asking you to perform a merge. Follow the instructions, and you should start seeing confirmations in your command window for every file merged:

image

If you have local changes in the target directory, you’ll need to resolve them manually. From there, your merge of your shelveset from the /source to the /target will be complete.

I ran into an interesting problem recently while installing the (download ). Upon execution of the setup, I received the following:

image

So naturally, the first place I went to look was on the Compatibility tab of the setup exe’s Properties. Lo and behold, here’s what I found:

image

I have to say, I’ve never run into that issue before. Why would the compatibility checkbox be disabled?

Digging a little deeper by heading out to the readme designated in the error window above, here’s what section 2.1.10 says:

Visual Studio Setup cannot run in program compatibility mode.  Ensure that the compatibility mode setting is not enabled system-wide or for the Visual Studio Setup application.

Just below that are some registry hacks that fixed the issue for me (you may have to reboot after changing):

Check Program Compatibility Assistant registry settings

Compatibility mode could have been set by Program Compatibility Assistant on earlier failed or canceled attempts to run Visual Studio setup.exe.

  1. Click Start, and then click Run.
  2. Type regedit, and then click OK.
  3. Browse to each of the following keys and delete any value that refers to setup.exe in the Visual Studio install path:
    • HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Compatibility Assistant\Persisted
    • HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers

And there you have it. The compatibility mode checkbox will now be disabled so you can uncheck the box.

image

Archives