How to change icon for menu command in Visual Studio Extension?

I published a Visual Studio 2010 extension called Duplicate Selection , which is mainly called using a hotkey. However, it also has a menu item in the "Edit" menu. All this works fine, but I want to change the icon for the menu item. The icon for the menu item must be defined in the .vsct file:

<Commands package="guidDupSelectionPkg"> <Groups> <Group guid="guidDupSelectionCmdSet" id="MyMenuGroup" priority="0x0600"> <Parent guid="guidSHLMainMenu" id="IDM_VS_MENU_EDIT"/> </Group> </Groups> <Buttons> <Button guid="guidDupSelectionCmdSet" id="cmdidDupSelection" priority="0x0100" type="Button"> <Parent guid="guidDupSelectionCmdSet" id="MyMenuGroup" /> <Icon guid="guidCmdIcon" id="bmpCmdIcon" /> <CommandFlag>DynamicVisibility</CommandFlag> <CommandFlag>DontCache</CommandFlag> <CommandFlag>DefaultInvisible</CommandFlag> <Strings> <CommandName>cmdidDupSelection</CommandName> <ButtonText>Duplicate Selection</ButtonText> </Strings> </Button> </Buttons> <Bitmaps> <!--<Bitmap guid="guidImages" href="Resources\Images_32bit.bmp" usedList="bmpPic1, bmpPic2, bmpPicSearch, bmpPicX, bmpPicArrows"/>--> <Bitmap guid="guidCmdIcon" href="Resources\cmdicon.bmp" usedList="bmpCmdIcon" /> </Bitmaps> </Commands> <KeyBindings> <KeyBinding guid="guidDupSelectionCmdSet" id="cmdidDupSelection" key1="D" mod1="Alt" editor="guidVSStd97"/> </KeyBindings> <Symbols> <GuidSymbol name="guidDupSelectionPkg" value="{e5f7e157-f686-46b7-a588-85b08cdaa5f0}" /> <GuidSymbol name="guidDupSelectionCmdSet" value="{85dcd5f2-19a5-4ee2-a99b-4fac4dc5c4ca}"> <IDSymbol name="MyMenuGroup" value="0x1020" /> <IDSymbol name="cmdidDupSelection" value="0x0100" /> </GuidSymbol> <!--<GuidSymbol name="guidImages" value="{63df12b7-6bf0-4b19-843d-3ec69e08439d}"> <IDSymbol name="bmpPic1" value="1" /> <IDSymbol name="bmpPic2" value="2" /> <IDSymbol name="bmpPicSearch" value="3" /> <IDSymbol name="bmpPicX" value="4" /> <IDSymbol name="bmpPicArrows" value="5" /> </GuidSymbol>--> <GuidSymbol name="guidCmdIcon" value="{e4cc0e42-a09d-4602-a965-d2b3f7e1f496}"> <IDSymbol name="bmpCmdIcon" value="1" /> </GuidSymbol> </Symbols> 

You can see that I commented on old definitions that I no longer want to use, and added my own. At the top, I have <Icon guid="guidCmdIcon" id="bmpCmdIcon" /> , which should reference my new bitmap. When I run the project under the debugger, the experimental VS instance still uses the old icon! Is this a bug in VS? This icon is not yet defined in my vsct file. How could he use her? Did I do something wrong here?

Any suggestions or specs will be considered. I tried several different things, but I'm officially fixated on this.

+4
source share
1 answer

Visual Studio creates a private cache for the menu data, so it does not need to load a DLL that provides resources unnecessarily. Delete this (hidden) file and try debugging again:

% LocalAppData% \ Microsoft \ VisualStudio \ 10.0Exp \ 1033 \ devenv.CTM

This article describes the process of merging menus in more detail, if you're interested.

+4
source

All Articles