解决 IronBarcode 中的运行时复制异常

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

在某些罕见情况下,由于我们特殊机器学习模型的 DLL 文件没有正确复制,会导致此错误。 下面的解决方案可以解决这个一次性错误。

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

解决方案

  1. 解决此问题的方案是首先导航至 runtimes 文件夹。 在您的解决方案中,这将位于 /bin/Debug/net6.0/runtimes 之下(Debug 仅为示例,请遵循您已设置的配置)。 (If you're using a different target framework, replace net6.0.)
  2. 您将在 /runtimes/ 中看到所有受支持的平台和操作系统目录,请进入适用于您的目录,并手动将文件复制到输出目录 /bin/Debug/net6.0/ 中。
  3. 禁用机器学习扫描也可以防止出现此错误。 但是,您应该注意,关闭 ML 扫描可能会使某些条形码更难被检测到,因为此功能有助于条形码检测。
// 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 下载 2,240,258 | 版本: 2026.5 just released
Still Scrolling Icon

还在滚动吗?

想快速获得证据? PM > Install-Package BarCode
运行示例 观看您的字符串变成 BarCode。