Monthly Archives: July 2014

Unshelving TFS shelveset to a different location or branch

  1. Install Microsoft Visual Studio Team Foundation Server 2013 Power Tools, then open command line and cd into a location where you have your TFS workspace otherwise TFTP will show error
    C:\Windows\System32>tfpt unshelve
    Unable to determine the workspace.
  2. Run tfpt unshelve /?
    c:\Source\Project\tfpt>unshelve /?
    tfpt unshelve - Unshelve into workspace with pending changes
    This command has two separate modes of operation:
    1. Migrate: allows migration of shelved changes from one branch into another
       by rewriting server paths.
    2. Undo: allows changes from an already-unshelved shelveset to be undone,
       cleaning up pending adds, and preserving other existing pending changes in
       the workspace.
    Usage: tfpt unshelve /migrate /source:serverpath /target:serverpath
                         [shelvesetname[;username]] [/backup]
           tfpt unshelve /undo shelvesetname[;username] [/batchsize:num]
                         [/recursive] [filespec...]
     shelvesetname          The name of the shelveset to unshelve
     /backup                Creates a backup shelveset
     /migrate               Rewrite the server paths of the shelved items
                            (for example to unshelve into another branch)
     /source:serverpath     Source location for path rewrite (supply with /migrate)
     /target:serverpath     Target location for path rewrite (supply with /migrate)
     /undo                  Undo pending changes from an unshelved shelveset
     /batchsize:num         Set the batch size for server calls (default 500)
  3. The option you need to execute is unshelve /migrate. Specify /source, /target and shelvesetname – that should be enough. You may need to resolve conflicts, in most cases AutoMerge in the pop up dialog will do the trick.


Netstat and System.Net.HttpListenerException (0x80004005)

Recently I was developing web service with several Web APIs. After few check-ins I decided to step through the code.

The service wouldn’t start. What? “It worked on my machine” just few hour ago. What’s wrong?

The exception was coming out of System.Net.HttpListener (I write in C#) and the message was following: System.Net.HttpListenerException (0x80004005): The process cannot access the file because it is being used by another process.

Maybe there is a bastard process from the previous run? I checked Process Explorer – nothing. I also have ISS up and running – which I decided to stop:

iisreset -stop

I couldn’t do that either, it would throw a an error. “That’s getting more interesting”, I thought. Well, most likely something is using ports that my web service is listening on. Which port would it be? I had only 80 and 8080 ports opened on my web service. But what is it?

C:>netstat -ano | findstr :80 | findstr LISTENING
  TCP  LISTENING       6112

OK, so the PID of the server is 6112, let’s take a look what it is. Skype! Wow, that’s interesting – it was running in the background and I never had issues with it, but for whatever reason it started to listen on that port. I killed skype process and moved on to debugging my code.