Visual Studio Hacks
Tips

When /ResetAddin Doesn’t Quite Cut It

by dstokes on August 3, 2008

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:

  1. 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).
  2. devenv.exe /ResetAddin <namespace.addinclass>
  3. Start Visual Studio without replacing your add-in files and then shutdown Visual Studio.
  4. 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.

blog comments powered by Disqus

Previous post: Visual Studio Links #60

Next post: Visual Studio Links #61