1

我正在使用 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. */
}

项目类型是库。现在,问题是我如何让它在别人的电脑上运行?如果你碰巧知道一些教程或类似的东西,请告诉我。互联网上有关于开发 Outlook 插件的资源,但是对于 NetOffice,它们似乎有所不同。NetOffice 本身有很好的开发文档,但没有部署文档(至少我还没有找到)。

我也很乐意提供所需的任何其他详细信息。

4

2 回答 2

3

为了让 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");
于 2016-01-14T08:26:31.347 回答
0

用于开发 Office 加载项的库并不重要。所有 COM 加载项的部署过程都是相同的。请参阅 MSDN 中的部署 Office 解决方案部分。

于 2015-06-24T08:16:24.253 回答