簡體   English   中英

Fitnesse Slim 跑步者無法加載 .net 5 程序集:從文件中提取清單導入時出錯(hr = 0x80131018)

[英]Fitnesse Slim runner cannot load .net 5 assembly: Error extracting manifest import from file (hr = 0x80131018)

在 Fitnesse 中運行測試給出:

無法完成測試:fitnesse.slim.SlimError:錯誤 SLiM 服務器在 Header 消息可以讀取之前死亡。

當使用 Slim RunnerW.exe 調試我的測試時,我得到一個異常:

System.BadImageFormatException :無法加載文件或程序集“file:///c:\path\assemby.exe”或其依賴項之一。 該模塊應包含程序集清單。

我使用 ProcessExplorer 檢查 RunnerW.exe 以 64 位模式運行。 我的代碼是用“任何 CPU”編譯的,與另一個工作項目的唯一區別是它是一個 .net 5(核心)項目,使用 FitSharp 2.8.2.1 NuGet ZEFE90A8E604A7C840E88D03AD6

啟用 FusionLog 后,很明顯它無法加載我的主要測試程序集。 這是日志的一部分:

LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: No application configuration file found.
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Attempting download of new URL file:///C:/path/assembly.exe.
LOG: Assembly download was successful. Attempting setup of file: C:\path\assembly.exe
LOG: Entering run-from-source setup phase.
ERR: Error extracting manifest import from file (hr = 0x80131018).
ERR: Run-from-source setup phase failed with hr = 0x80131018.
ERR: Failed to complete setup of assembly (hr = 0x80131018). Probing terminated.

我認為它正在嘗試將 a.Net 5 程序集加載到 a.Net 4 進程中?

任何想法如何解決這個問題? 我想添加一個 app.config 文件並指定一個運行時,但我不確定,它可能只是一個兔子洞,因為我們似乎需要在這里混合框架?

一些最終讓我啟動並運行的事情:

1:不要引用可執行文件(以.exe結尾的文件),而是引用.dll 無論如何編譯,嘗試將 .exe 文件作為程序集加載總是會拋出System.BadImageFormatException

2:從 NuGet package 中Runner.exeRunnerW.exe (及其依賴項)的 .Net Core 版本,並使用它們代替舊的 SLIM.Net 運行程序(如果您正在遷移)。 FusionLog對.Net Core 完全沒有任何作用,所以如果有任何日志記錄,那么您就知道該進程沒有運行.Net Core。

3:如果您從GitHub獲得 FitSharp 項目,並且鏈接到項目而不是使用 NuGet,則刪除構建后操作以復制文件。 取而代之的是 go 到您的測試項目Dependencies -> Projects -> fit open Properties (F4) 並設置選項Reference Output AssemblyCopy LocalCopy Local Sattelite Assemblies為 Yes。 對 FitSharp 和 Runner 項目執行相同的操作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM