c# - AspNetCompiler - An attempt was made to load program with an incorrect format -
i building 64bit web application (assemblya
) , referencing application have built 64bit (assemblyb
).
when add assemblyb
reference in assemblya
, following compilation error in visual studio:
aspnetcompiler not load file or assembly 'assemblyb' or 1 of dependencies. attempt made load program incorrect format.
both of application's platform target setting set x64
, both target framework settings .net framework 4.6
, prefer 32bit unchecked
.
i have tried referencing every dependent reference of assemblyb
in assemblya
, making sure versions of dependent references same.
i have used question: how determine if .net assembly built x86 or x64? confirm referenced assemblies either msil
or amd64
.
i have used aspnet_compiler.exe
command line tool errorstack
option enabled , got following stack trace:
[badimageformatexception]: not load file or assembly 'assemblyb' or 1 of dependencies. attempt made load program incorrect format.
at system.reflection.runtimeassembly._nload(assemblyname filename, string codebase, evidence assemblysecurity, runtimeassembly locationhint, stackcrawlmark& stackmark, intptr pprivhostbinder, boolean throwonfilenotfound, boolean forintro spection, boolean suppresssecuritychecks)
at system.reflection.runtimeassembly.nload(assemblyname filename, string code base, evidence assemblysecurity, runtimeassembly locationhint, stackcrawlmark& s tackmark, intptr pprivhostbinder, boolean throwonfilenotfound, boolean forintros pection, 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.internalload(string assemblystring, evidence assemblysecurity, stackcrawlmark &stackmark, intptr pprivhostbinder, boolean forintrospection)
at system.reflection.runtimeassembly.internalload(string assemblystring, evidence assemblysecurity, stackcrawlmark &stackmark, boolean forintrospection)
at system.reflection.assembly.load(string assemblystring)
at system.web.configuration.compilationsection.loadassemblyhelper(string assemblyname, boolean stardirective)
[configurationerrorsexception]: not load file or assembly 'assemblyb' or 1 of dependencies. attempt made load program incorrect format.
at system.web.configuration.compilationsection.loadassemblyhelper(string assemblyname, boolean stardirective)
at system.web.configuration.compilationsection.loadallassembliesfromappdomain bindirectory()
at system.web.configuration.compilationsection.loadassembly(assemblyinfo ai)
at system.web.compilation.buildmanager.getreferencedassemblies(compilationsection compconfig)
at system.web.compilation.buildmanager.getprestartinitmethodsfromreferencedassemblies()
at system.web.compilation.buildmanager.callprestartinitmethods(string prestar tinitlistpath, boolean& isrefassemblyloaded)
at system.web.compilation.buildmanager.executepreappstart()
at system.web.hosting.hostingenvironment.initialize(applicationmanager appmanager, iapplicationhost apphost, iconfigmappathfactory configmappathfactory, host ingenvironmentparameters hostingparameters, policylevel policylevel, exception appdomaincreationexception)
i have looked @ following related questions , none answer question. relate iis configuration, not case compilation error, or have solution setting project allow 32bit platform target, not suitable case:
- "an attempt made load program incorrect format" when platforms same (no uses iis config)
- could not load file or assembly ... attempt made load program incorrect format (system.badimageformatexception) (no runtime error)
- system.badimageformatexception attempt made load program incorrect format (no uses 32bit solution)
- could not load file or assembly 'xxx' or 1 of dependencies. attempt made load program incorrect format (no uses 32bit solution)
i @ loss go here. reiterate, do not want set either of projects 32bit , isn't problem iis config compilation error.
i have tried on several different machines , on brand new applications same result.
how fix compilation error?
Comments
Post a Comment