【问题标题】:x86/x64 The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)x86/x64 给定的程序集名称或代码库无效。 (来自 HRESULT 的异常:0x80131047)
【发布时间】:2017-07-23 10:20:41
【问题描述】:

早上好,

我正在为 word 开发一个 C# 插件,第一版被编译为在 office word x64 下运行,但现在我必须在 x86 版本下运行它,在调试模式下加载项目时出现此错误:给定的程序集名称或代码库无效。 (来自 HRESULT 的异常:0x80131047) 异常文本:

System.IO.FileLoadException: Impossible de Charger le fichier ou l'assembly 'AppName, Version=1.0.0.0, Culture=neutral' ou une de ses dépendances。 Le nom ou le 代码库 de l'assembly donné n'est pas valide。 (HRESULT 异常:0x80131047) Nom de fichier: 'AppName, Version=1.0.0.0, Culture=neutral' à System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) à System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, 证据 assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark & stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) à System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) à System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean for Introspection) à System.Reflection.Assembly.Load(String assemblyString) à Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.CreateEntryPoint(String entryPointTypeName) à Microsoft.VisualStudio.Tools.Office.Runtime.DomainCreator.ExecuteCustomization.Microsoft.VisualStudio.Tools.Office.Runtime.Interop.IExecuteCustomization2.LoadEntryPoints(IntPtr serviceProvider)

我已经检查了我的代码,没有引用...

我怀疑 GAC_32、GAC_64、GAC_MSIL 文件夹有问题

有什么想法吗?

【问题讨论】:

    标签: c# x86 64-bit gac


    【解决方案1】:

    我发现解决此问题的唯一方法是直接复制过去 x86 虚拟机中新 VSTO 项目中的代码。通过这种方式,我已经能够生成版本 x64、x86 和任何处理器!

    【讨论】:

      猜你喜欢
      • 2020-01-05
      • 2013-07-21
      • 2014-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多