When developing Visual Studio Add-Ins, one of the first handy tips you will need is /ResetAddin. The syntax goes like this:
devenv.exe /ResetAddin <namespace.addinclass>
This command will remove all registered commands for a VS add-in and will remove any tool window settings as well. The problem is that occasionally this will not remove everything you need. One example of this is when an exception is thrown from a command handler all the way back to Visual Studio.
This is very bad form for an add-in developer, but it usually happens early in your development process at least once or twice and Visual Studio will effectively quarantine your add-in. I’ve run across a few instances where /ResetAddin would not fix the situation and I had to take the following steps to get the add-in to run again:
- Remove your .addin file and add-in assembly from the install location (This is usually “Documents and Settings\User\My Documents\Visual Studio 200x\AddIns” for most people during development on XP).
- devenv.exe /ResetAddin <namespace.addinclass>
- Start Visual Studio without replacing your add-in files and then shutdown Visual Studio.
- Replace your .addin file and add-in assembly and startup Visual Studio as usual.
Additionally, you should add the appropriate exception handling code to your command handler before proceeding so you won’t have to repeat this again but following the above steps should get everything back to normal.