Outlook加载项在调试器中工作,但无法与MSI或ClickOnce发布一起安装 [英] Outlook add-in works in debugger but can't install with MSI or ClickOnce publish

查看:123
本文介绍了Outlook加载项在调试器中工作,但无法与MSI或ClickOnce发布一起安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我继承了在Visual Studio 2005中.net 2框架中开发的Outlook 2007加载项。我在我的VS 2010中打开了解决方案并将其转换为VS2010格式。


我有这些PC用于开发和测试: 



  • Win7 64位PC与Office 32位
  • Win7 64位PC与Office  64位
  • Win 7 32位与Office 32位

我需要在Windows 7(32位和64位)上使用Outlook 2010(32位和64位)


我在所有开发PC上都安装了VS 2010,并将目标平台分别设置为x64和x86。它们全部编译,当使用f5进行调试时,所有内容都完美无缺,加载项加载并正常工作。


但如果我构建安装项目并使用MSI文件安装它安装没有错误但不会将加载项加载到Outlook中。它是一个禁用的加载项。进入File / Options / Add ins / Go ...并选择禁用的加载项显示加载行为:加载COM加载项时出现运行时
错误。


如果我发布了加载项目,它就创建了exe& vsto&其他文件,当我使用该methid安装时,我在加载项的AddInSpy中得到thuis错误

找不到加载项DLL路径。 System.BadImageFormatException:无法加载文件或程序集'file:/// C:\DocOneAddIn Installer \ Application Files \DocumentONEOutlookAddIn_1_0_3_4 \DocumentONEOutlookAddIn.dll.deploy'或其依赖项之一。此程序集由比当前加载的运行时更新的运行时构建,无法加载。 
文件名:'file:/// C:\DocOneAddIn Installer \ Application Files \DocumentONEOutlookAddIn_1_1_3_4 \DocumentONEOutlookAddIn.dll.deploy'
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase,Evidence assemblySecurity,Assembly locationHint,StackCrawlMark& stackMark,Boolean throwOnFileNotFound,Boolean forIntrospection)
at System.Reflection.Assembly.nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,Assembly locationHint,StackCrawlMark& stackMark,Boolean throwOnFileNotFound ,forIntrospection)
在System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,Evidence assemblySecurity,StackCrawlMark& stackMark,Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile,Evidence securityEvidence,Byte [] hashValue,AssemblyHashAlgorithm hashAlgorithm,Boolean forIntrospection,StackCrawlMark& stackMark)
at System.Refle ction.Assembly.ReflectionOnlyLoadFrom(String assemblyFile)
at AddInSpy.AssemblyScanner.GetAssemblyInfo(String fileName,String hostName,Boolean isVstoAddIn)

WRN:程序集绑定日志记录已关闭。
要启用程序集绑定失败日志记录,请将注册表值[HKLM \Software\Microsoft \Fusion!EnableLog](DWORD)设置为1.
注意:程序集绑定会导致一些性能损失故障记录。
要关闭此功能,请删除注册表值[HKLM \Software\Microsoft \Fusion!EnableLog]。



我不明白为什么它在调试器中完美运行但是当你构建或发布并安装加载项时,它永远不会正确地加载说"这个程序集是由比当前加载的运行时更新的运行时构建的,不能加载。"


当前加载的运行时(我不知道的.net版本可能是???)如何正常运行Outlook或者什么时候调试代码时启动它?


任何人都有一个解决方案,我在使这个安装程序工作时缺少什么步骤?


谢谢你提前

Craig

解决方案

我还注意到,当我运行调试器时,得到的加载项加载并正常工作确实在StatusDescription中报告AddInSpy中的错误:"加载项DLL路径不是实测值"然而它以某种方式设法完美地工作!


AddInSpy中的DLLPath位于我的VS项目的bin \ Release目录中。而MIS安装的DllPath如下所示:








C:\ Program Files \Document ONE Ltd\Document ONE Outlook AddIn for Office 2010 \DocumentONEOutlookAddIn.dll

单击一次发布安装程序后,其DllPath具有以下内容:








C:\DocONE \DocONE加载项\Application Files \DocumentONEOutlookAddIn_1_1_3_7 \DocumentONEOutlookAddIn.dll

虽然我的理解是它实际上应该使用放在我的用户目录中的DLL:


C:\ Users \ cvertigan \ AppData \ Local @\\Apps\2.0\NMKO3982.0B3\TZ0N88BE.C6W\docu..ddin_13c9a5cf43020e7c_0002.0000_none_52dcefd72fc0f399 / DocumentONEOutlookAddIn.dll


 


I have inherited an Outlook 2007 add-in that was developed in visual studio 2005 in the .net 2 framework. I have opened the solution in my VS 2010 and converted it to VS2010 format.

I have these PC's for developing and testing on: 

  • Win7 64 bit PC with Office 32 bit
  • Win7 64 bit PC with Office 64 bit
  • Win 7 32 bit with Office 32 bit

I need to get this working in Outlook 2010 (both 32 & 64 bit) on Windows 7 (both 32 & 64 bit)

I have VS 2010 on all dev PCs and have set the target platform to x64 and x86 on them respectively. They all compile and when debugging with f5 all goes perfectly and the add-in gets loaded and works properly.

But if I build the setup project and install using the MSI file it installs without errors but won't load the add-in into Outlook. It is a disabled add-in. Going into File/Options/Add ins/Go... and selecting the disabled add-in shows load behaviour: a runtime error ocurred during the loading of the COM Add-in.

If i publish the add-in project it created the exe & vsto & other files and when I install using that methid I get thuis error in AddInSpy for the add-in

Add-in DLL path is not found. System.BadImageFormatException: Could not load file or assembly 'file:///C:\DocOneAddIn Installer\Application Files\DocumentONEOutlookAddIn_1_0_3_4\DocumentONEOutlookAddIn.dll.deploy' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
File name: 'file:///C:\DocOneAddIn Installer\Application Files\DocumentONEOutlookAddIn_1_0_3_4\DocumentONEOutlookAddIn.dll.deploy'
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.ReflectionOnlyLoadFrom(String assemblyFile)
   at AddInSpy.AssemblyScanner.GetAssemblyInfo(String fileName, String hostName, Boolean isVstoAddIn)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].


I don't understand why it works perfectly in debugger but when you build or publish and install the add-in it never loads properly saying that "This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded."

How is the currently loaded runtime (of what I don't know - .net version perhaps???) any different between running Outlook normally or when it is launched when debugging the code?

Anyone have a solution on what step I am missing in getting this installer to work?

Thanks in advance
Craig

解决方案

I also just noticed that when I run the debugger the add-in that gets loaded and works properly does actually report an error in AddInSpy in the StatusDescription: "Add-in DLL path is not found." Yet somehow it manages to work perfectly!

The DLLPath in AddInSpy is in the bin\Release directory of my VS project. Whereas the DllPath is as follows for the one installed by the MIS:

C:\Program Files\Document ONE Ltd\Document ONE Outlook AddIn for Office 2010\DocumentONEOutlookAddIn.dll

The click once publish installer one has the following for its DllPath:

C:\DocONE\DocONE Add-in\Application Files\DocumentONEOutlookAddIn_1_0_3_7\DocumentONEOutlookAddIn.dll

though it is my understanding that it should actually be using the DLL that gets put into my user directory here:

C:\Users\cvertigan\AppData\Local\Apps\2.0\NMKO3982.0B3\TZ0N88BE.C6W\docu..ddin_13c9a5cf43020e7c_0002.0000_none_52dcefd72fc0f399/DocumentONEOutlookAddIn.dll

 


这篇关于Outlook加载项在调试器中工作,但无法与MSI或ClickOnce发布一起安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆