Hi,
When i reset the IDE by "devenv /resetsettings" from the commandline, my add-in
gets removed from the 'Tools' menu. Then i need to drag it from the Tools\Customize..
to the 'Tools' menu.
Can anyone tell me how to restore my Add-in to the Tools menu after resetting the
IDE or point me articles regarding this

Restoring Add-Ins after Resetting the IDE
Antoine_MS
That is true the all named command are not removed when calling /resetsettings, only the UI is resetted.
The addin I've made validate each time it is opened that the ui is still present, thus assuring evrything will be ready to use.
In my case, I add menus, toolbar and a section in the toolbox. To verify if the UI is present, I try to get the menu and toolbar by using its name, Like this:
CommandBars CMDBars = (CommandBars)applicationObject.CommandBars;
// get menubar
menuCommandBar = (CommandBar)CMDBars["MenuBar"];
if menuCommandBar is null, MenuBar does not exist and I recreate it. That is an example, menubar always exists in vs.
I don't think there's an other way around, it's your responsability to check if the ui you've created is not reset by the environment.
Selea
Hi Padma,
When you do a /resetsettings, the command bars are reset to defaults and you lose the add-in's command on the Tools menu. At that point, the only way to programmatically restore the command is to re-add it using Commands2.AddNamedCommand2(). The code in your add-in's OnConnection event shows how to do this.
One way to make this easier to do is to copy the relevent code (located in the OnConnection event) into a new console .exe, then set up a macro to run it in VS whenever you need it. Either that or add the code to an existing application and call it there.
Hope this helps,
Regards,
-Kemp Brown [MSFT]
_scoot_
Hi,
I referred this http://support.microsoft.com/kb/816167/en-us and created the same sample to test and it got installed perfectly and worked . When i reset the IDE, it got removed from the 'Tools' menu.
If i create a new console application with code in the OnConnection event, i dont know how to provide the parameters that should be available to the event when it got fired, say for example, the first parameter - "object application" - to which the instance of my IDE has to be passed (Please correct me when my idea on this is wrong, as i am new to AddIns )
Can you please explain me to some more extentClaudio Benghi
Hi Kemp Brown,
Thanks for your reply. I've used Command2.AddNamedCommand2() in OnConnection event. Still the add-in gets removed from the 'Tools' menu on reset.
Hello1234567891
> When you do a /resetsettings, the command bars
> are reset to defaults and you lose the add-in's command
> on the Tools menu. At that point, the only way to programmatically
> restore the command is to re-add it using Commands2.AddNamedCommand2().
Hi Kemp,
AFAIK, /resetsettings does not remove the commands of the add-in, only the controls and toolbars, so there is no need to call AddNamedCommand2 to recreate the commands (would fail anyway). Can you confirm this
There are several problems here with VS 2005 when resetting the settings or doing an Import/Export Settings:
1) When VS resets the settings or does an Import/Export Settings, it affects also the UI created by add-ins. This behavior is questionable (IMO it should not affect add-ins) but when I reported this in the MSDN Feedback Center the MS guy insisted that it was correct. This behavior breaks add-ins if they try to remove their UI on the unload phase, because the UI is no longer there. Most add-ins developers are not aware of this and their add-in crash systematically.
2) If the add-in tries to avoid that crash unloading itself when it detects the Tools, Import/Export settings command event, when the add-in is reloaded the commandbars and buttons fail to be added (another crash). It seems that something internally in VS is not in the proper state. You need to restart the IDE to reload the add-in correctly. I have a bug report open about this problem in the MSDN Feedback Center (whose server is now down so I can’t report the URL).
3) The problem reported by Padma: resetting the settings destroys the UI of add-ins, but it does not reset the PreloadAddinStateManaged flag for add-ins. So, the add-ins don’t get the UISetup flag in the next OnConnection call to recreate the UI of the add-in. My add-in works because it does not use permanent UI (it does not use the UISetup flag) and it recreates the UI each time that it is loaded (and it removes it when unloaded), but for add-ins using UISetup this is fatal, because the user needs to either uninstall/reinstall the add-in, or change manually in the registry the PreloadAddinStateManaged flag.
Best regards,
Carlos Quintero
Microsoft MVP Visual Basic