Outlook插件未在Win10 Office2016上加载

时间:2017-11-01 07:42:32

标签: c# visual-studio-2013 outlook outlook-addin office-2016

我知道有多篇帖子,博客等与同一期刊有关,但没有一篇对我有帮助,因此我在这里发表这个问题是为了获得一些专家意见。

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

我的前景插件在Win7,Win8.1,Outlook 2013,2016上完美无缺。

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

我已按照Hamed Ahmadi in his blog提供的所有步骤操作。 但他们都没有帮助。

Fusion日志:

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上测试了它,并且它在这些环境中运行良好。

有什么可能出错的线索?

1 个答案:

答案 0 :(得分:0)

最后,我能够解决我的问题。

问题在于我在Visual Studio Installer项目中的注册表项。

我使用[INSTALLDIR]PhishLabs.OutlookAddin.vsto|vstolocal在Win7,Win8.1部署中运行得非常好,但在Win10中失败了。

我已将INSTALLDIR替换为TARGETDIR,现在在Win10上工作正常。

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