【问题标题】:C# Outlook Addin Error on Release - "Add-in DLL path is not found."发布时出现 C# Outlook 插件错误 - “未找到插件 DLL 路径。”
【发布时间】:2013-11-01 17:45:40
【问题描述】:

下午好,堆栈交换,

我正在尝试发布我的 Outlook 2013 加载项以供其他人使用。我已经在我的计算机上安装了我的插件,当我单击功能区按钮时,不会加载任何窗口,但它在调试模式下会加载。由于某种原因,现在它似乎在我的 PC 上运行良好,但是当它安装在其他几台计算机上时,它安装并且功能区可见,但是当单击功能区按钮时没有任何反应(一个窗口应该打开)。

我决定下载“AddInSpy”并在我的计算机和其他人的计算机上查看我的应用程序。所有关于我的插件都显示相同的错误:

Add-in DLL path is not found. System.BadImageFormatException: Could not load file or assembly 'file:///C:\Users\Alexander Harvey\Desktop\Addin\Application Files\De_Facto_Addin_1_0_0_12\De_Facto_Addin.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:\Users\Alexander Harvey\Desktop\Addin\Application Files\De_Facto_Addin_1_0_0_12\De_Facto_Addin.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)

我完全被困在这个问题上,并且已经尝试了 3 个小时来解决问题。所以任何帮助将不胜感激。谢谢你。

【问题讨论】:

  • 您是如何安装插件的?使用 ClickOnce?微星安装程序?我也会怀疑 x64/x86 的兼容性。
  • @etaiso ClickOne 使用 AnyCPU 构建配置
  • 据我所知,AnyCPU 对您没有帮助,因为 TargetPlatform 只能设置为 x86/x64。更多信息请看这里:stackoverflow.com/questions/753412/…

标签: c# outlook-addin outlook-2013


【解决方案1】:

您应该尝试使用日志记录。这意味着您将能够查明您的问题。

我建议使用 Log4Net 并在启动时在每一行添加一个日志输出。

我遇到了类似的问题,我就是这样解决的,最后只是一个愚蠢的拼写错误:P

【讨论】:

  • 当窗口打算同时加载时,应用程序还将 MailItem 保存到文件夹中。我的 saveas 行是这样的:mail.SaveAs(@"C:\test\message.msg); 这导致应用程序在其他用户计算机上失败,因为它没有创建测试文件夹的权限或者它不存在。我为他们创建了文件夹,一切正常。我现在正在使用临时文件夹。 我不明白为什么这个简单的问题会导致 BadImageFormatException 错误?
  • 如何使用这个记录器?哪个文件应该使用记录器?
  • @rank1 查看本指南,了解如何使用 Log4Net。希望这有助于您入门:codeproject.com/Articles/14819/How-to-use-log-net
猜你喜欢
  • 2011-06-06
  • 1970-01-01
  • 2016-12-06
  • 1970-01-01
  • 2021-12-02
  • 1970-01-01
  • 2017-06-26
  • 1970-01-01
相关资源
最近更新 更多