我正在使用 NetOffice 开发 Outlook 插件。这个插件在我的本地机器上工作时(不知何故神奇地)通过 Visual Studio 部署(如果我运行项目然后打开 Outlook,功能就在那里)。一切都很好,直到这里。但是,我需要将它部署到其他人的计算机(没有安装 VS),我真的很难找到如何做到这一点的方法。
我的插件是这样的:
[COMAddin(Constants.ProjectName, "Tool", 3)]
[Guid("B3F60319-1A11-4F3E-9C1B-3AE908D9CA86"), ProgId("Tool.OutlookIntegration")]
public class OutlookIntegration : COMAddin
{
public OutlookIntegration()
{
this.OnStartupComplete += new OnStartupCompleteEventHandler(this.Integrate);
_settings = new Settings();
}
/* Integrate creates a menu item which does what I need. */
}
项目类型是图书馆。现在,问题是我如何让它在别人的 PC 上运行?如果您碰巧知道一些教程或类似的东西,请告诉我。 Internet 上有关于开发 Outlook 插件的资源,但它们似乎与 NetOffice 不同。 NetOffice 本身有很好的开发文档,但没有用于部署的文档(至少我还没有找到)。
我也很乐意提供所需的任何其他详细信息。
最佳答案
为了让 Outlook 安装插件,您唯一要做的就是在注册表中添加一些记录
string runKey = "SOFTWARE\\Microsoft\\Office\\Outlook\\Addins";
RegistryKey startupKey = Registry.CurrentUser.OpenSubKey(runKey, true);
if (startupKey != null)
{
runKey="SOFTWARE\\Microsoft\\Office\\Outlook\\Addins\\yourAddinNameSpace.yourAddinClass";
startupKey = Registry.CurrentUser.OpenSubKey(runKey, true);
if (startupKey == null)
startupKey = Registry.CurrentUser.CreateSubKey(runKey);
startupKey.SetValue("Description", "yourAddinName", Microsoft.Win32.RegistryValueKind.String);
startupKey.SetValue("FriendlyName", "yourAddinName", Microsoft.Win32.RegistryValueKind.String);
startupKey.SetValue("LoadBehavior", 3, Microsoft.Win32.RegistryValueKind.DWord);
}
}
else
Console.WriteLine("Outlook is not installed");
关于c# - NetOffice Outlook 插件部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31021104/