Using Visual Studio 2010 I created an Office 2010 Word add-in project that has a ribbon with a couple of basic controls. I haven't even added code yet. When I debug the project Word launches and that ribbon ("Ribbon 1") is shown. All good so far, but...
Problem 1: Now when I open any Word document that same ribbon is still there!
Problem 2: I have a 2nd ribbon ("Ribbon 2") that I'm working on in another project. When I debug that, BOTH Ribbon 1 and Ribbon 2 appear combined as 1 ribbon! And that combined ribbon still shows the next time I open any Word document.
The source of both problems seems to be that Visual Studio is not properly uninstalling the ribbon when I stop debugging. I've been working around it by manually installing the ribbon myself and then uninstalling it via VSTOInstaller.exe -- a real pain.
How can I make sure the ribbon is completely removed when I stop debugging?
(I found a similar question here but neither answer is clear.)
When a VSTO add-in is installed, it is added to the Windows registry under HKEY_CURRENT_USER\Software\Microsoft\Office\Word\Addins
for Word. (Add-ins for other Office apps are nearby.)
The easiest thing would be to write your own console app that simply removes your add-in from that registry location. All it would need to do is delete the sub key that's named the same as your add-in. Then you could run that utility whenever you're finished with your debugging session.
If you want it to happen automatically, then you'd need to figure out how to hook into Visual Studio for an event that fires when you stop debugging and remove the add-in from the registry there. I've never tried anything like that though.