【问题标题】:This addin caused outlook to start slowly此插件导致 Outlook 启动缓慢
【发布时间】:2014-03-19 13:26:46
【问题描述】:

我正在使用 C#.NET 4.5 开发 Outlook 插件项目 但是在我部署之后,有时 Outlook 会禁用我的插件,并显示此消息。 “这个插件导致 Outlook 启动缓慢”“我不知道我的插件有什么问题。 这只有几个代码,而ThisAddIn_Startup在这个项目中是空的。 这是代码...

   public partial class ThisAddIn
   {
   private void ThisAddIn_Startup(object sender, System.EventArgs e)
   {

   }

   private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
   {
   }
   protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
   {
       return new Ribbon1();
   }


   #region VSTO generated code

   /// <summary>
   /// Required method for Designer support - do not modify
   /// the contents of this method with the code editor.
   /// </summary>
   private void InternalStartup()
   {
       this.Startup += new System.EventHandler(ThisAddIn_Startup);
       this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
   }

   #endregion
   }


   <?xml version="1.0" encoding="UTF-8"?>
  <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"         önLoad="Ribbon_Load">
   <contextMenus>
   <contextMenu idMso="ContextMenuContactItem">
     <menuSeparator id="mniMailItemMenuSeparator" />
     <button id="customButton"
            label="Call using Software"   insertBeforeQ="Copy"
          imageMso="Call"
           önAction="OnMyButtonClick" />

    </contextMenu>
   <contextMenu idMso="ContextMenuMailItem">
     <menuSeparator id="mailmenusep1" />
     <button id="mailbutton" insertBeforeQ="Copy"
          label="Call using Software"

         imageMso="Call"
           önAction="MailItemCallNumbers"   />

   </contextMenu>
  </contextMenus>

 </customUI>

【问题讨论】:

    标签: c# outlook vsto add-in


    【解决方案1】:

    从 Outlook 2013 开始,Microsoft 引入了新的加载项性能标准。欲了解更多信息,请参阅http://msdn.microsoft.com/en-us/library/office/jj228679.aspx#ol15WhatsNew_AddinDisabling

    在您的情况下,Outlook 正在加载 .Net 框架并考虑将成本作为加载项的一部分。本机 COM 加载项的加载速度往往比 .Net 加载项快。

    正如文章指出的那样(在“系统管理员对加载项的控制”部分,有一个组策略设置允许您指定哪些加载项始终启用、始终禁用(阻止)或可配置用户。

    虽然不推荐,但当 Outlook 选择“始终启用此加载项”时 (as described here),您可以直接将加载项添加到以下注册表项。

    HKCU\Software\Microsoft\Office\15.0\Outlook\Resiliency\DoNotDisableAddinList
    

    要提高基于 VTSO 的插件的性能,请参阅Performance Improvements Coming Soon to a Service Pack Near You

    要更改加载项的加载时间,请参阅Delay-loading the CLR in Office Add-ins

    【讨论】:

      【解决方案2】:

      如果您在调试模式下构建加载项并将调试器附加到它,则可能会在空项目上发生这种情况。附加时将所有符号文件加载到调试器所需的额外时间可能比 Outlook 预期的“稳定”插件初始化所需的时间更长。

      您不必担心这一点,除非它发生在没有附加调试器的发布版本中。在开发过程中,您可以简单地告诉 Outlook 永远不要禁用您的插件。

      【讨论】:

        【解决方案3】:

        尝试延迟加载插件。尝试将 Load Behavior 设置为 8 或 9 以进行按需加载。

        查看更多 http://blogs.msdn.com/b/andreww/archive/2008/04/19/delay-loading-the-clr-in-office-add-ins.aspx

        【讨论】:

          【解决方案4】:

          我知道这是一篇较旧的帖子,但我在网上找到了一些对我有帮助的东西。

          您的帖子说“这个插件导致 Outlook 启动缓慢,我不知道我的插件有什么问题。”我发现如果您添加一个特定的环境变量,将会出现更强大的消息。

          从开始菜单,右键单击计算机-> 属性-> 高级系统设置-> 单击环境变量按钮。单击名为 System Variables 的底部窗格下的 New 按钮并添加以下内容。输入变量值为 0(零)的“VSTO_SUPPRESSDISPLAYALERTS”。应该是这样的。

          现在重新打开您的加载项所附加的应用程序,对我来说它是 Outlook。当加载项启动时,错误消息现在应该出现一个详细信息按钮,单击并通读异常。对我来说,它看起来像这样。

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2018-05-02
            • 1970-01-01
            相关资源
            最近更新 更多