Visual studio VS加载项:在web应用程序上添加上下文按钮

Visual studio VS加载项:在web应用程序上添加上下文按钮,visual-studio,Visual Studio,我在胡闹VisualStudio2008加载项。我希望能够在所有web应用程序上下文菜单中添加一个按钮,该按钮将基于web部署工具中的共享存档为网站设置IIS 我已经能够在项目上下文菜单上添加上下文项: public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) { applicationObject=DTE2application;

我在胡闹VisualStudio2008加载项。我希望能够在所有web应用程序上下文菜单中添加一个按钮,该按钮将基于web部署工具中的共享存档为网站设置IIS

我已经能够在项目上下文菜单上添加上下文项:

public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{ applicationObject=DTE2application; 附加值=附加值

if (connectMode == ext_ConnectMode.ext_cm_UISetup) {
    var contextGuids = new Object[] {};
    var iisSetupCommand = applicationObject.Commands.AddNamedCommand(
        addInInstance,
        CommandNameSetupIis,
        "Setup IIS",
        "Create the bindings in IIS for the website. Requires an IIS folder in the project root with the archive xml files for the website.",
        true,
        52,
        ref contextGuids,
        (int) vsCommandStatus.vsCommandStatusSupported + (int) vsCommandStatus.vsCommandStatusEnabled
        );

    var commandBars = (CommandBars) applicationObject.CommandBars;
    var projectMenu = commandBars["Project"];
    iisSetupCommand.AddControl(projectMenu, projectMenu.Controls.Count + 1);
}
}

这是可行的,但我很难走得更远

问题1是按钮在单击时消失

问题2是我不知道如何只显示web应用程序项目的按钮

问题3是,我需要编写代码来获取iis存档、当前项目目录路径和项目名称,以创建iis绑定,然后使用这些设置运行web部署工具

这个插件非常迟钝。我已经尽可能多地在谷歌上搜索并阅读了大多数糟糕的msdn文档。我找到的最好的信息是:


有人能帮忙吗

问题1:覆盖查询状态并将状态设置为vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled

问题2:我认为这是不可能的。可以获取项目类型,但只有在单击按钮后QueryStatus才会在单击按钮一次后触发

问题3:项目路径可通过connect.ApplicationObject.ActiveSolutionProjects访问