運行時複製異常

This article was translated from English: Does it need improvement?
Translated
View the article in English

在某些罕見情況下,由於我們特殊機器學習模型的 DLL 檔案沒有正確複製,會導致此錯誤。 下面的解決方案可以解決這個一次性錯誤。

IronQrDetection.Exceptions.IronQrRuntimesCopyException:機器學習 DLL 未成功從執行時間目錄自動複製。 這種情況可能發生在各種作業系統或框架上。 請依照以下文章中的步驟解決此問題:https://ironsoftware.com/csharp/qr/troubleshooting/runtimes-copy-exception/

解決方案

1.找到runtimes資料夾: 導航到解決方案中的runtimes資料夾。 可以在/bin/Debug/net6.0/runtimes找到(如果目標框架不同,請將Debug替換為目前配置,將net6.0替換為目標框架)。

2.複製必要文件:/runtimes/目錄中,您會找到所有支援平台和作業系統的子目錄。 進入與您的作業系統相關的目錄,並將必要的檔案手動複製到輸出目錄: /bin/Debug/net6.0/

   # Example bash command to copy files on Unix-like systems
   cp /bin/Debug/net6.0/runtimes/<your-platform>/* /bin/Debug/net6.0/
   # Example bash command to copy files on Unix-like systems
   cp /bin/Debug/net6.0/runtimes/<your-platform>/* /bin/Debug/net6.0/
SHELL
   # Example PowerShell command to copy files on Windows systems
   Copy-Item -Path .\bin\Debug\net6.0\runtimes\<your-platform>\* -Destination .\bin\Debug\net6.0\
   # Example PowerShell command to copy files on Windows systems
   Copy-Item -Path .\bin\Debug\net6.0\runtimes\<your-platform>\* -Destination .\bin\Debug\net6.0\
SHELL

請確保您已更換<your-platform>選擇與您的平台相符的對應目錄(例如, win-x64osx-x64linux-x64等)。

3.重建並測試: 複製必要文件後,重新建置專案以驗證問題是否已解決。 現在應該已經提供了正確的 DLL 文件,機器學習模型可以正常運作了。

Curtis Chau
技術作家

Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。

除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。

準備好開始了嗎?
Nuget 下載 51,390 | Version: 2025.11 剛發表