運行時複製異常

Curtis Chau
Curtis Chau
已更新: 2026年8月2日

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

IronQrDetection.Exceptions.IronQrRuntimesCopyException : Machine learning DLLs were not successfully automatically copied from the runtimes directory. This may occur on various operating systems or frameworks. Please follow the steps in the following article to resolve this issue: https://ironsoftware.com/csharp/qr/troubleshooting/runtimes-copy-exception/
Text

解決方案

  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/
    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\
    SHELL

    確保您將 <your-platform> 替換為符合您平台的適當目錄(例如 win-x64、osx-x64、linux-x64 等)。

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

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

閱讀更多

準備好開始了嗎?

NuGet 下載次數 83,364版本:2026.11剛剛發布