ML.OnnxRuntime Build Error

When using the IronBarcode ZIP package, you might encounter the following error message:

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        

Reason

This happens when Microsoft.ML.OnnxRuntime is not installed immediately after adding the project references from the IronBarcode ZIP file, before building the entire project.

Solution

Unfortunately, this issue seems to stem from a known problem within the Microsoft build system, and there is no immediate fix in the current project setup.

The recommended approach is to create a new project from scratch and reinstall the necessary dependencies in a specific order:

Steps to Resolve:

  1. Create a new project
  2. Add project reference to IronBarcode DLLs
  3. Install Microsoft.ML.OnnxRuntime
  4. Build the project