2009-03-17 12 views

答えて

1

あなたは、コマンドライン(例でDEVENV.EXE/resetaddin Your.AddIn.Nameを実行しようとしたことがありdevenv.exe/resetaddin MyAddin1.Connect)?

1

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

1

次のコードは、(!bulletproof'dない)アドイン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); 
    } 
} 
+0

コードは動作するはずですが、私のプロジェクトにそのコードを置くことは何もしません。私はまだ私のコマンドintのツールメニューを持っていると私は設定したブレークポイントを通過することができます外観から何も変わっていません –

+0

新しいVSアドインを作成する場合、このコードは動作しますか? –

関連する問題