Resolve Runtime Copy Exceptions in 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 是一個示例,請遵循您設置的配置) (如果您使用不同的目標框架,請更換 net6.0)。
  2. 您將在 /runtimes/ 中看到所有支持的平台和操作系統作為目錄,進入適用於您的目錄,然後手動將文件複製到輸出 /bin/Debug/net6.0/ 目錄中。
  3. 禁用機器學習掃描也可以防止該錯誤。 然而,您應注意,關閉機器學習掃描可能會使某些條形碼更難檢測,因為該功能有助於條形碼檢測。
// 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 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。

除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。

準備好開始了嗎?
Nuget 下載 1,935,276 | 版本: 2025.11 剛剛發布