C# 是否发生System.BadImageFormat异常?

C# 是否发生System.BadImageFormat异常?,c#,C#,在自动化运行时,我收到系统.BadImageFormatException。已成功生成程序集。但问题仅在验证组件时出现 为了解决这个问题,我检查了安装位置中是否存在corflags.exe System.BadImageFormatException was unhandled HResult=-2147024885 Message=Could not load file or assembly 'file:///C:\Work\Demo.GeckoHtmlRenderer.Base

在自动化运行时,我收到
系统.BadImageFormatException
。已成功生成程序集。但问题仅在验证组件时出现

为了解决这个问题,我检查了安装位置中是否存在
corflags.exe

  System.BadImageFormatException was unhandled
  HResult=-2147024885
  Message=Could not load file or assembly 'file:///C:\Work\Demo.GeckoHtmlRenderer.Base.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.
  Source=mscorlib
  FileName=file:///C:\Work\Demo.GeckoHtmlRenderer.Base.dll
  FusionLog=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].

  StackTrace:
       at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
       at System.Reflection.Assembly.LoadFrom(String assemblyFile)
       at InstallVerifier.InstallChecker.AuthenticodeVerifier(String dll, String authenticode, String sign)
       at InstallVerifier.Program.Main(String[] args)
  InnerException:

可能与32/64位引用的程序集相关。我在尝试运行一个32位应用程序时遇到了一个非常类似的问题,该应用程序访问的Oracle服务器只安装了64位版本的Oracle客户端。这似乎是32位/64位问题请在发布之前尽可能少地研究您的问题。搜索异常名称会产生262个问题,它们都有相同的答案。