Outlook 加载项未在 Win10 Office2016 上加载

Outlook addin not loading up on Win10 Office2016

我知道有多个帖子、博客等与同一问题相关,但其中 none 对我有帮助,因此我将此问题发布在这里以征求专家意见。

Environment: Windows 10, Office 2016, .Net Framework 4.5.1, Visual Studio 2010 Tools for Office runtime

我的 outlook 插件在 Win7、Win8.1、Outlook 2013、2016 上运行良好。

问题: Outlook 加载项未在 Outlook 启动时加载,我看到 LoadBehaviour 从 3 变为 2。 当我双击并从安装位置安装 .vsto 文件时,加载项安装成功,但在 outlook 启动期间加载项仍然未加载。

我已按照 Hamed Ahmadi in his blog 提供的所有步骤进行操作。 但是 none 帮助了他们。

融合日志:

The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\Windows\syswow64\MsiExec.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: Where-ref bind. Location = C:\Program Files (x86)\myaddin\myaddin.OutlookAddin\myaddin.OutlookAddin.dll
LOG: Appbase = file:///C:/Windows/syswow64/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MsiExec.exe
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: No application configuration file found.
LOG: Using host configuration file: C:\Users\anupraj\AppData\Local\Temp\CFG1405.tmp
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/myaddin/myaddin.OutlookAddin/myaddin.OutlookAddin.dll.
LOG: Assembly download was successful. Attempting setup of file: C:\Program Files (x86)\myaddin\myaddin.OutlookAddin\myaddin.OutlookAddin.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: myaddin.OutlookAddin, Version=1.0.4.0, Culture=neutral, PublicKeyToken=08126df2ce1c130e
LOG: Re-apply policy for where-ref bind.
LOG: Post-policy reference: myaddin.OutlookAddin, Version=1.0.4.0, Culture=neutral, PublicKeyToken=08126df2ce1c130e
LOG: GAC Lookup was unsuccessful.
LOG: Where-ref bind Codebase does not match what is found in default context. Keep the result in LoadFrom context.
LOG: Binding succeeds. Returns assembly from C:\Program Files (x86)\myaddin\myaddin.OutlookAddin\myaddin.OutlookAddin.dll.
LOG: Assembly is loaded in LoadFrom load context.

我不太习惯阅读融合日志,因此无法推断出它在说什么。

我厌倦了使用这个 Github Code 的 AddinSpy,但是对于我的加载项我得到了这个异常。

System.ArgumentException: Destination array is not long enough to copy all the items in the collection. Check array index and length.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.BitConverter.ToInt32(Byte[] value, Int32 startIndex)
   at AddInSpy.ILReader.Next() in e:\POC\AddInSpy-master\AddInScanEngine\ILReader.cs:line 79
   at AddInSpy.ILReader.<GetEnumerator>d__0.MoveNext() in e:\POC\AddInSpy-master\AddInScanEngine\ILReader.cs:line 51
   at AddInSpy.AssemblyScanner.CheckCustomTaskPaneType(Assembly assembly, ArrayList& assemblyInfo) in e:\POC\AddInSpy-master\AddInScanEngine\AssemblyScanner.cs:line 251

注意:当我在这个Win10 Office 2016环境中尝试运行来自visual studio的加载项代码时,加载项正在加载正常,没有问题。

我正在使用 .msi 来部署我的加载项,我已经在 Win7、Win8.1 上对其进行了测试,并且它在这些环境中运行良好。

知道可能出了什么问题吗?

终于,我解决了我的问题。

问题出在我在 Visual Studio 安装程序项目中的注册表项上。

我使用的是 [INSTALLDIR]PhishLabs.OutlookAddin.vsto|vstolocal,它在 Win7、Win8.1 部署中运行良好,但在 Win10 中却失败了。

我已经将 INSTALLDIR 替换为 TARGETDIR,现在在 Win10 上运行良好。

[TARGETDIR]PhishLabs.OutlookAddin.vsto|vstolocal就是你所需要的。