Click here to Skip to main content
13,346,713 members (65,436 online)
Click here to Skip to main content
Add your own
alternative version


34 bookmarked
Posted 11 Jul 2002

Changing the Visual Studio .NET Add-in Default Tool Menu Item Icon

, 11 Jul 2002
Rate this:
Please Sign up or sign in to vote.
This article discusses how to change the icon that is placed on the tools menu by the Visual Studio .NET Add-in Wizard
<!-- Download Links --> <!-- Article image -->

Sample Image - vsnet_addin_icon_change.gif

Difference in application GUI is just that I took the first screenshot at work, the second at home.

<!-- Add the rest of your HTML here -->

Let the Wizard Guide You

This article came about because I wanted to make an Add-In for Visual Studio .NET. The Wizard makes this relatively painless. You can find the wizard under File/New/Project, then under Other Projects/Extensibility Projects/Visual Studio .NET Add-in. Make sure to check the box that says "Yes, create a 'Tools' menu item."

Once the wizard is finished, you can then build the add-in and then run the setup MSI that is included in the new solution. Then when you press F5 to bring up a debugging session Visual Studio .NET will be launched and in this new instance, you should be able to see your new add-in under the tools menu. It should look like the first image at the top of this page (unless you renamed your project, it will be your project's name in that case).

Creating the Satellite DLL

In order for the IDE to find your new icon, you must embed the bitmap in an external generic Win32 C DLL. You cannot insert the bitmap into the assembly containing the Add-in. Why it was done this way, I cannot tell you.

To build this Win32 satellite DLL, you must add a new project to the add-in solution. You can do this from File/Add Project/New Project, then under Visual C++/Win32 Project. In the window that pops up, click Application Settings and then click DLL then Finish.

Now find the bitmap you wish to use as your icon and add it to the DLL project. There are certain restrictions on the bitmap. These are:

  • It must be 16 pixels by 16 pixels
  • It must be a 16 color bitmap
  • The color to use for transparency is Red = 0, Green = 254, Blue = 0 (RGB=00FE00h)

Note: The bright green that is on the palette by default is not the correct green.

Now add a resource file to the project. Then in resource view, right-click on the newly added .rc file and then click Add Resource then Import to insert the bitmap into the resource file. In the properties panel, change the ID of the bitmap from "IDB_BITMAP1" to "1" (no quotes). Build the solution.

You now have a satellite DLL with the bitmap embedded.

Associating the Satellite DLL with the Add-in

Now that you have a satellite DLL, you need to tell Visual Studio .NET that it is there. This is done via the registry. Two values need to be added to HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE Software\Microsoft\VisualStudio\7.0\Addins\<AddInName> (make sure to change the <AddInName> to the actual name of your add-in:

Note: The hive to add these values to depends on if you chose the option to have it installed so that everyone can use it.

  • SatelliteDLLName = NameOfTheDLL.DLL
  • SatelliteDLLPath = C:\InstallPathOfTheAddIn

Both of these can be done via the installer that is in the solution. Just right-click on the deployment solution and go to View/Registry. To get the installation folder on installation, use [TARGETDIR] as the value set in the SatelliteDLLPath variable.

The next thing to do is to place the satellite DLL in a special folder underneath the installation folder. This folder is the <SatelliteDLLPath>\1033. The 1033 is just the ID number of the English_Language/Sub-language_English_US. If your system is not a US system you will need to place the satellite DLL in your localized code number directory.

You can set this directory by right-clicking on the deployment project and going to View\File System. Then add a directory under Application Folder, specifying 1033 (or you preferred language directory) as the folder name. Then you need to add the primary output of the satellite DLL project to this directory. This can be done via a right-click on the deployment project and then clicking Add/Project Output, then moving the primary output of the DLL to the language directory.

A Code Change

Now that the association is done, you need to open the file Connect.cs in the main add-in project and find the OnConnection method. In this method locate the try/catch block at the bottom (it should look like this):

    Command command = commands.AddNamedCommand(addInInstance, "MyAddin1", "MyAddin1",
        "Executes the command for MyAddin1", true, 59, ref contextGUIDS,
    CommandBar commandBar = (CommandBar)commandBars["Tools"];
    CommandBarControl commandBarControl = command.AddControl(commandBar, 1);
catch(System.Exception /*e*/)

The important line is:

Command command = commands.AddNamedCommand(addInInstance, "MyAddin1", 
"MyAddin1", "Executes the command for MyAddin1", true, 59, ref contextGUIDS, 

Change the true to false and 59 to 1. This tells Visual Studio .NET that the bitmap is not a built in icon, instead look at the add-in's satellite DLL and load the bitmap with the ID '1'.

Now if you build the project and then reinstall the add-in your icon should have changed.

Some Gotchas

  • If the add-in does not display in the IDE, run the file ReCreateCommands.reg in the main add-in directory and restart the IDE.
  • Also rerunning the installation process seems to fix the same problem (sometimes).


I would like to thank Carlos for his newsgroup posts, where I found a lot of the answers for my Add-in questions.

Also, I used the MSDN Library for some info; though the MSDN Library seems lacking in the VS .NET Add-in documentation.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Nathan Blomquist
Software Developer
United States United States
No Biography provided

You may also be interested in...


Comments and Discussions

QuestionVC++ 6.0 Toolbar Application to be deployed in DOTNET Pin
thatharo20-Nov-05 21:02
memberthatharo20-Nov-05 21:02 
QuestionHow to execute MyAddin menu Pin
Anonymous14-Jul-05 1:50
sussAnonymous14-Jul-05 1:50 
AnswerRe: How to execute MyAddin menu Pin
Nathan Blomquist14-Jul-05 5:18
memberNathan Blomquist14-Jul-05 5:18 
GeneralRe: How to execute MyAddin menu Pin
yu-yu14-Jul-05 15:38
memberyu-yu14-Jul-05 15:38 
GeneralDarn useful! Pin
soup21-Jun-04 0:08
membersoup21-Jun-04 0:08 
QuestionHow to change BuildTool of file in Add in Pin
""21-Feb-03 9:33
member""21-Feb-03 9:33 
GeneralRun devenv /setup Pin
Douglas Earl6-Dec-02 12:41
memberDouglas Earl6-Dec-02 12:41 
GeneralRegistering Pin
Julien Grosclaude11-Nov-02 9:59
sussJulien Grosclaude11-Nov-02 9:59 
GeneralRe: Registering Pin
Nathan Blomquist12-Nov-02 8:10
memberNathan Blomquist12-Nov-02 8:10 
GeneralThe registry way... Pin
Heath Stewart2-Oct-02 18:53
memberHeath Stewart2-Oct-02 18:53 
GeneralRe: The registry way... Pin
dang!2-Sep-03 16:21
memberdang!2-Sep-03 16:21 
GeneralRe: The registry way... Pin
Heath Stewart2-Sep-03 17:56
editorHeath Stewart2-Sep-03 17:56 
GeneralRe: The registry way... Pin
dang!2-Sep-03 18:02
memberdang!2-Sep-03 18:02 
GeneralRe: The registry way... Pin
Heath Stewart2-Sep-03 18:05
editorHeath Stewart2-Sep-03 18:05 
GeneralRe: The registry way... Pin
okigan11-Jan-04 12:36
memberokigan11-Jan-04 12:36 
GeneralRe: The registry way... Pin
Nathan Blomquist12-Jan-04 3:58
memberNathan Blomquist12-Jan-04 3:58 
GeneralAnd... Pin
Anonymous15-Jul-02 4:46
sussAnonymous15-Jul-02 4:46 
GeneralRe: And... Pin
Jamie Nordmeyer16-Jul-02 6:40
memberJamie Nordmeyer16-Jul-02 6:40 
GeneralRe: And... Pin
Alexandru Stanciu4-Nov-05 1:14
memberAlexandru Stanciu4-Nov-05 1:14 
GeneralRe: And... Pin
Shof8-Apr-07 23:43
memberShof8-Apr-07 23:43 
Generalsame on MSDN Pin
SteveKing15-Jul-02 0:08
memberSteveKing15-Jul-02 0:08 
GeneralVery informative - Well done! Pin
Andy Metcalfe13-Jul-02 11:57
memberAndy Metcalfe13-Jul-02 11:57 
GeneralRe: Very informative - Well done! Pin
Nathan Blomquist13-Jul-02 13:47
memberNathan Blomquist13-Jul-02 13:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.180111.1 | Last Updated 12 Jul 2002
Article Copyright 2002 by Nathan Blomquist
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid