運行時複製異常
在某些罕見情況下,由於我們特殊機器學習模型的 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/
# 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\
請確保將
<your-platform>替換為您的平台對應的目錄(例如,linux-x64等)。
3.重建並測試: 複製必要文件後,重新建置專案以驗證問題是否已解決。 現在應該已經提供了正確的 DLL 文件,機器學習模型可以正常運作了。

