TFPT – “An item with the same key has already been added.”

This day I struggled into an issue with migrating a shelveset from one branch to another. Unfortunately, an error appeared, so I got stuck.

To migrate my shelveset, I use tfpt.exe, that comes with Microsoft Teamfoundation Powertools 2015. So, I first started with typing following command into a developer command prompt:
tfpt unshelve migrate /source:”$/RootProject/SubProject/Branch1” /target:”$/RootProject/SubProject/Branche2” “shelvesetName”

Hint: To get this working, make sure you are calling tfpt.exe from the path, that is the root of you mapped path under beneath. In my case, I would go by “cd” to c:\Projects\RootProject\SubProject\Branch1

Now a dialog appears, that displays all shelveset details.image

From here you can go migrating this by clicking “Unshelve”. The next Dialog, that should appear, should display a bunch of unresolved conflicts, if any. These, you can either merge automatically ore by hand – it’s up to you. In my case nothing happened and console brought up an error – instead of the second dialog, saying “An item with the same key has already been added”. The content of this message is not really descriptive and meaningful… so what is the cause?

First I tried to figure out, where the root cause of this message was, but (honestly) then I felt more and more lazy, doing deep dive, so I considered looking up hints by the use of a Search engine Winking smile.

Here I found several solutions, ranging from adventure, over useless to senseless. But in general – luckily – there were recommendations for undoing pending changes in source (and often also for undoing these in target branch).

I tried some of these hints, but nothing worked. So I played a little bit around and found, that I was that far from a solution with undoing pending changes. It was not only undoing for source and target branch, but it was undoing everything in my Workspace to get that error message away and letting tfpt.exe work as expected.

As a conclusion, be sure, that you first make a “backup” of all pending changes in your workspace, by sending these to a temporary shelveset. Than you can undo all changes and migrate you desired shelveset to the target branche, that you chose before. After successful migration/move, you can restore the “Backup”-shelveset to your workspace. There you are…you moved a shelveset.

Chocolatey – a sweet package manager for Windows

Some days ago a friend of mine talked some curios things about chocolate or something like that, to me. First I did’not understand, what he’d like to say, but than it became a little clearer to me.

Chocolatey…, is no sweet or something of that kind, but it is a powerful new package manager for Windows user, that Safes a lot of time.

The old way

As a user afflicted with permanent System Setups and therefor permanently reinstalling the most common tools that are often used, like Notepad++ or KeePass , I found chocolatey sweet as chocolate.

Chocolatey is, as I mentioned before, a Kind of Package Manager like opkg, apm or other package manager known from Linux OS. Developers – mainly Visual Studio Devs – know that concept from NuGet. With that Chocolatey it’s now pretty simple, keeping the own local repository of tools clean and maintainable with a Windows OS.

Consider the following scenario (you know that, of course):
You have a PC, that is fresh and clean – reinstalled after a system crash (or for other reason ). Now you have to go through a huge list of often used tools, that you can recall. But most times you are not catching all of them. So you are engaged with installing tools a long time after reinstallation.
Ok…. lucky guy, if you have all of the tools as portables saved to an USB stick, but in that moment, you don’t know, where to find this stick or it’s laying around some where in your home – where you are not.
Same applies to uninstalling software. Sometimes you do not have installed software and you don’t know, where it has been saved to. In that case, you either have to install other software to search for executable like Everything Search Engine or do it by hand. In all cases, it is hard to overcome his inhibition, to setup a new WinOS.

With Chocolatey things are changing…

I wrote a little powershell script, that keeps a of all tools, I need for my daily life. As an IT Pro, I often need Notepad++, KeePass, 7zip, GitHub, RegexTester, TreeSize and a lot more. This Script does the following. It downloads Chocolatey, if not already installed. It continues looping through my list of tools and  installs them each by another. The good thing with this approach is, that I have not to care about where to retrieve install files, updates and there is no more spamming of my download folder with Zips.
That script is saved to my OneDrive, so I have it “with me”, where ever I have to setup a machine.

Starting with Chocolatey (Homepage)

open up a Powershell as Administrator an type in the following line
iex ((new-object net.webclient).DownloadString ‘’))
(there is also a solution for cmd at theire hompage)

Now you can start installing a tool. Let’s take regextester!
Type choco install regextester 

You will be asked for permission to install, by typing 1 for YES
(that could be automated by the use of –y at the end of a install command)
What I also should mention is the fact, that, if a tool is, for example no installable (portable for example), choco generates an icon and a link, to find and execute it by mouse for example.

The chocolatey repository could be searched by two ways: at their hompage or from powershell choco list/search <keyword>
e.g. choco search regex
leads to following result:

Your local repository could be reviewed by
choco list –l

And removing a tools could not be any easier
choco uninstall recuva.portable

Updates, if there are any, could be made by
choco upgrade notepadplusplus


With these simple commands your own local repository is maintainable in an easy and fast way. The benefit of replaying these actions, either automated ore by hand, in “forward/backward”-style is so sweet, that I use it now consequently on all my dev-machines and friends PCs for maintenance. Build your own script or use mine and you will see, it could not be more simple.

(add that code to a file e.g. chocolatey_install.ps1 and call it with parameter 0, if you like to make a fresh install of chocolatey and tools or only upgrading local repository)


$tools = @(
“7zip”, #Packer
“notepadplusplus”, #texteditor
“procexp”, #process explorer (Task manager)
“adobereader”, #PDF reader
“keepass.install”, #password manager
“treesizefree.portable”, #getting filesizes (sorted/visualized overview)
“irfanview”, #picture viewer
“winmerge”, #comparing files and folders in file system (also usable with TFS)
“rdcman” #manages RDP sessions

if($upgrade -eq 0){
iex ((new-object net.webclient).DownloadString(‘′))

$tools | % {choco install $_ -y}
$tools | % {choco upgrade $_ -y}