Resolve Runtime Copy Exceptions in IronBarcode

This article was translated from English: Does it need improvement?
Translated
View the article in English

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.

Machine learning DLLs were not successfully automatically copied from the runtimes directory. This may occur on various operating systems or frameworks...

Solution

  1. The solution to this problem is to first navigate to the runtimes folder. In your solution, this will be under /bin/Debug/net6.0/runtimes (Debug is an example, follow the Configuration you have set) (If you're using a different target framework, replace net6.0).
  2. You will see all supported platforms and operating systems as directories in /runtimes/, go into the one that applies to you and copy the files out into the output /bin/Debug/net6.0/ directory manually.
  3. Disabling the ML scan can also prevent the error. However, you should note that turning off ML scanning might make it harder to detect some barcodes, as this feature helps with barcode detection.
// Define scanning options, disabling machine learning for basic scan only
var myOptionsExample = new BarcodeReaderOptions
{
    // ScanMode is set to only use the basic scan, without ML-enhanced features
    ScanMode = BarcodeScanMode.OnlyBasicScan
};

// Perform barcode reading with the specified options
var results = BarcodeReader.Read("barcode.png", myOptionsExample);
// Define scanning options, disabling machine learning for basic scan only
var myOptionsExample = new BarcodeReaderOptions
{
    // ScanMode is set to only use the basic scan, without ML-enhanced features
    ScanMode = BarcodeScanMode.OnlyBasicScan
};

// Perform barcode reading with the specified options
var results = BarcodeReader.Read("barcode.png", myOptionsExample);
' Define scanning options, disabling machine learning for basic scan only
Dim myOptionsExample = New BarcodeReaderOptions With {.ScanMode = BarcodeScanMode.OnlyBasicScan}

' Perform barcode reading with the specified options
Dim results = BarcodeReader.Read("barcode.png", myOptionsExample)
$vbLabelText   $csharpLabel
Curtis Chau
技术作家

Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。

除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。

准备开始了吗?
Nuget 下载 1,935,276 | 版本: 2025.11 刚刚发布