views:

25

answers:

0

I'm writing a Visual Studio add-in and have a 16x16 bitmap resource that I would like to use as the button image for my menu item.

Following these instructions from the MSDN, I renamed the resource 1 and the file 1.bmp, then edited Resources.resx accordingly:

<data name="1" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>..\1.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>

I then changed my call to Commands2.AddNamedCommand2, passing false and 1 as the arguments for MSOButton and Bitmap respectively:

Command command = commands.AddNamedCommand2(addIn, "MyAddIn", "MyAddIn", "Open MyAddIn", false, 1, ref contextGUIDS,
                                            (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton);

Now when I launch the add-in in Visual Studio, Commands2.AddNamedCommand2 throws a FileNotFoundException:

"Additional information: Could not load file or assembly 'MyAddIn.resources, Version=0.1.3939.33205, Culture=en, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified."

What am I doing wrong?