0

[ツール] メニューにメニュー項目がありますが、[ファイル] -> [新しい] メニューに移動する必要がありますが、事前に生成されたビジュアル スタジオ コードで [ツール] を [ファイル] に変更しても、期待どおりの結果が得られません!!! ?

4

3 に答える 3

1

コマンド ラインで devenv.exe /resetaddin Your.AddIn.Name を実行してみましたか (例: devenv.exe /resetaddin MyAddin1.Connect)?

于 2009-03-17T12:08:34.133 に答える
1

eventlistner コードも変更する必要があります。コードの上部にある自動生成されたコード セグメントを確認します。

于 2009-03-17T11:00:25.047 に答える
1

次のコード(防弾ではありません!)は、 Addin OnConnection メソッドでうまく機能します:

_applicationObject = (DTE2)application;
_addInInstance = (AddIn)addInInst;
if (connectMode == ext_ConnectMode.ext_cm_UISetup)
{
    object[] contextGUIDS = new object[] { };
    Commands2 commands = (Commands2)_applicationObject.Commands;

    CommandBars commandBars = (CommandBars)_applicationObject.CommandBars;
    CommandBar menuBarCommandBar = commandBars["MenuBar"];

    CommandBarPopup filePopup = menuBarCommandBar.Controls["File"] as CommandBarPopup;
    CommandBarPopup newPopup = filePopup.CommandBar.Controls["New"] as CommandBarPopup;

    Command command = commands.AddNamedCommand2(_addInInstance, "MyAddin1", "MyAddin1", 
        "Executes the command for MyAddin1", true, 59, ref contextGUIDS, 
        (int)(vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled),
        (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton);

    if (command != null && newPopup != null)
    {
        command.AddControl(newPopup.CommandBar, 1);
    }
}
于 2009-03-17T11:01:00.130 に答える