using ext_cm_Solution - never fires

S

seeni

I have tried to add a new command for a visual studio add-in. This command
should be added when the user loads any solution into the IDE(not at
startup). The command should disappears when the user closes the solution.

The MSDN says that ext_cm_Solution 4 The Add-in was loaded when a user
loaded a solution that required the Add-in.


So I have checked the connectmode in OnConnection method for the value
"ext_cm_Solution". Seems the caller of OnConnection never sends the value
ext_cm_Solution. I have inserted a MessageBox.Show(connectMode.ToString())
at the start of the function. I have not got the value ext_cm_Solution.

Here is my code segment
public void OnConnection(object application, Extensibility.ext_ConnectMode
connectMode, object addInInst, ref System.Array custom)

{

applicationObject = (_DTE)application;

addInInstance = (AddIn)addInInst;

MessageBox.Show(connectMode.ToString());

if(connectMode == Extensibility.ext_ConnectMode.ext_cm_Solution)

{

object []contextGUIDS = new object[] { };

Commands commands = applicationObject.Commands;

_CommandBars commandBars = applicationObject.CommandBars;



try

{

Command command = commands.AddNamedCommand(addInInstance,

"CleanCodeReviewComments",

"Clean Code Review Comments",

"Executes the command for CRAddIn",

false, 101, ref contextGUIDS,

(int)vsCommandStatus.vsCommandStatusSupported+(int)vsCommandStatus.vsCommand
StatusEnabled);

CommandBar commandBar = (CommandBar)commandBars["Tools"];

CommandBarControl commandBarControl = command.AddControl(commandBar, 1);

}

catch(System.Exception e)

{

MessageBox.Show(e.ToString());

}

}


}



Thanks,

-Seeni
 
A

Armin Zingler

seeni said:
I have tried to add a new command for a visual studio add-in. This
command should be added when the user loads any solution into the
IDE(not at startup). The command should disappears when the user
closes the solution.

Please post only to the appropriate groups. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top