DLL faltantes al crear el instalador MSI

Curtis Chau
Curtis Chau
Actualizado: 24 de septiembre de 2025

Al crear un instalador MSI, puede encontrarse con la siguiente excepción:

2025-01-27 16:57:23 - Error: IronBarCodeDetection.Exceptions.IronBarcodeDetectionException: Unexpected error occurred during execution of the IronBarcode Machine Learning library. Please provide details to support@ironsoftware.com for a resolution. ---> System.TypeInitializationException: The type initializer for 'Microsoft.ML.OnnxRuntime.NativeMethods' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.ML.OnnxRuntime.NativeMethods..cctor()
   --- End of inner exception stack trace ---
   at Microsoft.ML.OnnxRuntime.SessionOptions..ctor()
   at Iron.BarCode.Extensions.xjtagg`1..ctor(Stream dfepdx, SessionOptions dfepdy)
   at IronBarCodeDetection.BarcodeDetect.PredictObject[TModel](Stream modelStream)
   --- End of inner exception stack trace ---
   at IronBarCodeDetection.BarcodeDetect.PredictObject[TModel](Stream modelStream)
   at IronBarCodeDetection.BarcodeDetect.DetectBarCode()
   at Iron.BarCode.Extensions.cuewjf.ehxbbs(BarcodeDetect tlxjvd)
   at Iron.BarCode.Extensions.cuewjf.ehxbbr(AnyBitmap tlxjvd, Double tlxjve)
   at Iron.BarCode.Extensions.cuewjo.mvanli(AnyBitmap tlxjvd, Double tlxjve)
   at Iron.BarCode.Extensions.cuewjo.mvanlf(Image`1 tlxjvd)
   at Iron.BarCode.Extensions.cuewjo.mvankh(Object tlxjvd)
   at IronBarCode.BarcodeReader.Read(AnyBitmap inputImage, BarcodeReaderOptions barcodeReaderOptions)
   at WindowsFormsBarcode.Form1.btnBrowse_Click_1(Object sender, EventArgs e)
2025-01-27 16:57:23 - Error Message: Unexpected error occurred during execution of the IronBarcode Machine Learning library. Please provide details to support@ironsoftware.com for a resolution.
2025-01-27 16:57:23 - Inner Exception: The type initializer for 'Microsoft.ML.OnnxRuntime.NativeMethods' threw an exception.
2025-01-27 16:57:23 - Inner Exception Stack Trace:    at Microsoft.ML.OnnxRuntime.SessionOptions..ctor()
   at Iron.BarCode.Extensions.xjtagg`1..ctor(Stream dfepdx, SessionOptions dfepdy)
   at IronBarCodeDetection.BarcodeDetect.PredictObject[TModel](Stream modelStream)
Text

Razón

Este error ocurre porque la biblioteca no puede encontrar los archivos necesarios para funcionar correctamente.

Solución

Para garantizar que el instalador MSI se ejecute sin problemas, debe incluir los siguientes tres archivos en su proyecto de configuración: onnxruntime.dll, IronBarcodeInterop.dll, y ReaderInterop.dll. Estos archivos se generan cuando construyes el proyecto en modo Release:

  • onnxruntime.dll: Ubicado en MsiInstallerSample\MsiInstallerSample\bin\Release
  • IronBarcodeInterop.dll: Ubicado en MsiInstallerSample\MsiInstallerSample\bin\Release\runtimes\win-x86\native
  • ReaderInterop.dll: Ubicado en MsiInstallerSample\MsiInstallerSample\bin\Release\runtimes\win-x86\native

Asegúrese de que los tres archivos estén añadidos a su Proyecto de Configuración para evitar esta excepción.

Curtis Chau tiene una licenciatura en Ciencias de la Computación (Carleton University) y se especializa en el desarrollo front-end con experiencia en Node.js, TypeScript, JavaScript y React. Apasionado por crear interfaces de usuario intuitivas y estéticamente agradables, disfruta trabajando con frameworks modernos y creando manuales bien estructurados y visualmente atractivos.

Leer más

¿Listo para empezar?

Descargas de NuGet 2,575,633Versión:2026.11recién lanzado