EnvDTE.Command won't start...

  • Thread starter Thread starter Nadav
  • Start date Start date
N

Nadav

Hi,

Introduction:
****************
I am trying to add a new command to the .NET IDE.that will be used to manipulate the Cut&Paste operations.

The problem:
*****************
Of some reason upon triggering the command ( by pressing 'Global::Ctrl+Shift+v' ) I get the following error message: "The Add-in supporting this command could not be loaded......" Why is that happening?
Following is the code used to add the command:

The code ( C# ):
********************
object[] Attr = this.GetType().GetCustomAttributes(typeof(GuidAttribute), true);
object[] contextGUIDS = new object[] { Attr[0] };
m_cmdPasteSpecial = m_ApplicationObject.Commands.AddNamedCommand( m_AddInInstance
, "Edit.PasteSpecial"
, ""
, ""
, false
, 0
, ref contextGUIDS
, (int)EnvDTE.vsCommandStatus.vsCommandStatusSupported +
(int)EnvDTE.vsCommandStatus.vsCommandStatusEnabled);
m_cmdPasteSpecial.Bindings = "Global::Ctrl+Shift+v";
m_cmdPasteEvents = m_ApplicationObject.Events.get_CommandEvents(m_cmdPasteSpecial.Guid, m_cmdPasteSpecial.ID);
m_cmdPasteEvents.BeforeExecute += new _dispCommandEvents_BeforeExecuteEventHandler(this.BeforeExecutePasteSpecial);

Additional points:
**********************
1. I assume the IDE should 'know' to relate the command to the Add-In according to the 'm_AddInInstance' passed upon command creation.
2. In case what was written (1) is wrong I have also tried to associate the command with the Guid of the Add-In class by passing it's Guid of the class as the contextGUIDS, Still it didn't help...

What should I do so the IDE will associate the new command with my Add-In?

ThanX
Nadav,
See a Great profiling tool I have developed at http://www.ddevel.com
 
Try setting the MSOButton value to TRUE.
m_cmdPasteSpecial = m_ApplicationObject.Commands.AddNamedCommand(
m_AddInInstance
, "Edit.PasteSpecial"
, ""
, ""
, true
, 0
, ref contextGUIDS
, (int)EnvDTE.vsCommandStatus.vsCommandStatusSupported +
(int)EnvDTE.vsCommandStatus.vsCommandStatusEnabled);
m_cmdPasteSpecial.Bindings = "Global::Ctrl+Shift+v";


with it set to FALSE, the optional Bitmap ID "0" is invalid.

Anthony
 
Back
Top