ML.OnnxRuntime 建置錯誤
This article was translated from English: Does it need improvement?
Translated
View the article in English
使用 IronBarcode ZIP 套件時,您可能會遇到以下錯誤訊息:
Error (active) MSB3027
Could not copy "C:\Users\first\.nuget\packages\microsoft.ml.onnxruntime\1.18.1\runtimes\ios\native\onnxruntime.xcframework\ios-arm64_x86_64-maccatalyst\onnxruntime.framework\Headers\onnxruntime_session_options_config_keys.h" to "bin\Debug\net8.0\runtimes\ios\native\onnxruntime.xcframework\ios-arm64_x86_64-maccatalyst\onnxruntime.framework\Headers\onnxruntime_session_options_config_keys.h". Exceeded retry count of 10. Failed.
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets
5034
理由
此錯誤發生於從 IronBarcode ZIP 檔案新增專案參照後,若未立即安裝 Microsoft.ML.OnnxRuntime,且在建置整個專案之前。 此問題與檔案複製操作超過最大重試次數有關,這是組件未正確設定的徵兆。
解決方案
遺憾的是,此問題似乎是 Microsoft 建置系統中的已知問題,且在目前的專案設定中尚無立即可行的解決方案。
建議的做法是從頭建立一個新專案,並依照特定順序重新安裝必要的依賴項,這有助於確保建置系統能正確解析所有依賴項,並避免複製操作錯誤。
解決步驟:
- 建立新專案:在您的開發環境中建立一個新專案,從頭開始。
- 將 IronBarcode DLL 加入專案參考:請在專案設定中新增相應的 DLL 參考,以整合 IronBarcode程式庫。
- 安裝 Microsoft.ML.OnnxRuntime:在建置之前,請先安裝 Microsoft.ML.OnnxRuntime 套件。 這通常可透過 NuGet 套件管理員,或使用
dotnet add package Microsoft.ML.OnnxRuntime指令透過命令列來實現。 - 建置專案:在所有依賴項均已正確設定並安裝後,即可建置專案。 此操作順序有助於確保建置系統能取得必要的元件,從而正確運作。
遵循以下步驟,即可解決檔案複製問題,並讓建置流程順利完成。
準備好開始了嗎?
Nuget 下載 2,240,258 | 版本: 2026.5 just released

