我已经能够在项目上下文菜单上添加上下文项了:
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
applicationObject=(DTE2)应用程序;
addInInstance=(Add-)addInInst;
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是点击后按钮消失。
http://dotnetslackers.com/articles/vs_addin/Lessons_learned_from_Copy_to_Html_Add_in.aspx
有人能帮忙吗?