Runtimes Copy Exception

This error is caused in some rare cases where the DLLs for our special ML model are not copied over properly. In the solution below, you can solve this one-time error.

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/

Solution

  1. Locate the runtimes Folder: Navigate to the runtimes folder in your solution. This can be found at /bin/Debug/net6.0/runtimes (replace Debug with your current configuration and net6.0 with your target framework if it differs).

  2. Copy the Necessary Files: Within the /runtimes/ directory, you'll find subdirectories for all supported platforms and operating systems. Enter the directory that pertains to your operating system and manually copy the necessary files to the output directory: /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

    Ensure that you replace <your-platform> with the appropriate directory that matches your platform (e.g., win-x64, osx-x64, linux-x64, etc.).

  3. Rebuild and Test: After the necessary files are copied, rebuild your project to verify that the issue is resolved. The correct DLLs should now be available for the ML model to function.