创建新的 VSTO 会使 Outlook 崩溃

Creating a new VSTO crashes Outlook

有点奇怪。

我正在学习如何为 Outlook 创建 VSTO 加载项,但我几乎没有做太多,而我似乎已经完成的事情导致 Outlook 禁用它,因为加载时间太长。 (说需要1.57秒)

我所做的只是:

  1. 为 Outlook 2013 和 2016 VSTO 创建了一个新项目
  2. 通过转到“项目”->“添加新项”添加功能区
  3. 将功能区类型设置为Microsoft.Outlook.Explorer
  4. 添加了一个按钮
  5. 按 F5 进行测试

我比较担心如果自己开发的话,这个VSTO生成时间会不会长一些?

当您按下键盘上的 F5 按钮时,加载项在调试器下 运行 使用未优化的代码。我建议改为测试加载项的 RELEASE 配置。在那种情况下,您将获得一个没有定义调试符号的优化程序集,因此它应该 运行 快得多。

New in Outlook for developers 页面声明如下:

Extending the add-in resiliency pillar of Outlook 2010, Outlook 2013 monitors add-in performance metrics such as add-in startup, shutdown, folder switch, item open, and invoke frequency. Outlook records the elapsed time in milliseconds for each performance monitoring metric.

For example, the startup metric measures the time required by each connected add-in during Outlook startup. Outlook then computes the median startup time over 5 successive iterations. If the median startup time exceeds 1000 milliseconds (1 second), then Outlook disables the add-in and displays a notification to the user that an add-in has been disabled. The user has the option of always enabling the add-in, in which case Outlook will not disable the add-in even if the add-in exceeds the 1000 millisecond performance threshold