未能載入檔案或程式集 XX 或它的某乙個依賴項

2021-09-08 23:02:39 字數 3553 閱讀 2306

如果你將應用程式生成

x86而不是

any cpu

時,在64

位作業系統中不會出錯錯誤,而在

32位作業系統中可能會出現以下錯誤:

說明:執行當前 web 請求期間,出現未處理的異常。請檢查堆疊跟蹤資訊,以了解有關該錯誤以及**中導致錯誤的出處的詳細資訊。

異常詳細資訊:system.badimageformatexception: 未能載入檔案或程式集「lwtg.bll」或它的某乙個依賴項。試圖載入格式不正確的程式。

源錯誤:

執行當前 web 請求期間生成了未處理的異常。可以使用下面的異常堆疊跟蹤資訊確定有關異常原因和發生位置的資訊。

程式集載入跟蹤:下列資訊有助於確定程式集「lwtg.bll」無法載入的原因。

警告: 程式集繫結日誌記錄被關閉。

要啟用程式集繫結失敗日誌記錄,請將登錄檔值 [hklm\software\microsoft\fusion!enablelog] (dword)設定為 1。

注意: 會有一些與程式集繫結失敗日誌記錄關聯的效能損失。

要關閉此功能,請移除登錄檔值 [hklm\software\microsoft\fusion!enablelog]。

堆疊跟蹤:

[badimageformatexception: 未能載入檔案或程式集「lwtg.bll」或它的某乙個依賴項。試圖載入格式不正確的程式。]

system.reflection.assembly._nload(assemblyname filename, string codebase, evidence assemblysecurity, assembly locationhint, stackcrawlmark& stackmark, boolean throwonfilenotfound, boolean forintrospection) +0

system.reflection.assembly.nload(assemblyname filename, string codebase, evidence assemblysecurity, assembly locationhint, stackcrawlmark& stackmark, boolean throwonfilenotfound, boolean forintrospection) +50

system.reflection.assembly.internalload(assemblyname assemblyref, evidence assemblysecurity, stackcrawlmark& stackmark, boolean forintrospection) +211

system.reflection.assembly.internalload(string assemblystring, evidence assemblysecurity, stackcrawlmark& stackmark, boolean forintrospection) +141

system.reflection.assembly.load(string assemblystring) +25

system.web.configuration.compilationsection.loadassemblyhelper(string assemblyname, boolean stardirective) +32

[configurationerror***ception: 未能載入檔案或程式集「lwtg.bll」或它的某乙個依賴項。試圖載入格式不正確的程式。]

system.web.configuration.compilationsection.loadassemblyhelper(string assemblyname, boolean stardirective) +596

system.web.configuration.compilationsection.loadassembly(assemblyinfo ai) +46

system.web.compilation.buildmanager.getreferencedassemblies(compilationsection compconfig) +177

system.web.compilation.buildproviderscompiler..ctor(virtualpath configpath, boolean supportlocalization, string outputassemblyname) +180

system.web.compilation.codedirectorycompiler.getcodedirectoryassembly(virtualpath virtualdir, codedirectorytype dirtype, string assemblyname, stringset excludedsubdirectories, boolean isdirectoryallowed) +350

system.web.compilation.buildmanager.compilecodedirectory(virtualpath virtualdir, codedirectorytype dirtype, string assemblyname, stringset excludedsubdirectories) +125

system.web.compilation.buildmanager.compilecodedirectories() +525

system.web.compilation.buildmanager.ensuretoplevelfilescompiled() +448

[httpexception (0x80004005): 未能載入檔案或程式集「lwtg.bll」或它的某乙個依賴項。試圖載入格式不正確的程式。]

system.web.compilation.buildmanager.reporttoplevelcompilationexception() +57

system.web.compilation.buildmanager.ensuretoplevelfilescompiled() +612

[httpexception (0x80004005): 未能載入檔案或程式集「lwtg.bll」或它的某乙個依賴項。試圖載入格式不正確的程式。]

版本資訊:microsoft .net framework 版本:2.0.50727.1882; asp.net 版本:2.0.50727.1879

解決方法:

將應用程式生成為any cpu就可以了

未能載入檔案或程式集

不要做a位 修改為b位 的無用功。也不要做用a位 直接呼叫b位 庫這樣複雜 這樣容易出錯的傻事。只需讓a位 b位 的輸入輸出重定向到文字檔案,或修改a位 b位 讓其通過文字檔案輸入輸出。即可很方便地讓a位 b位兩種 之間協調工作。關於.net編譯的目標平台 anycpu,x86,x64 今天將呼叫s...

c 未能載入檔案或程式集

dll檔名與載入時的dll檔名不一致,dll檔案根本不存在,即出現丟失情況,載入dll路徑錯誤,即dll檔案存在,但載入路徑不正確 程式集版本錯誤。我a.dll內部引用的b.dll是1.0版本,而實績提供的b.dll是2.0的版本,所以在winfrom設計介面就報了這個找不到依賴項的錯誤。主要原因是...

分析「未能載入檔案或程式集」

未能載入檔案或程式集 newtonsoft.json,version 4.5.0.0,culture neutral,publickeytoken 30ad4fe6b2a6aeed 或它的某乙個依賴項。找到的程式集清單定義與程式集引用不匹配。異常來自 hresult 0x80131040 為什麼我們...