DLL manquantes lors de la création d'un programme d'installation MSI

Curtis Chau
Curtis Chau
Mis à jour : 24 septembre 2025

Lors de la création d'un installateur MSI, vous pouvez rencontrer l'exception suivante :

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

Raison

Cette erreur se produit car la bibliothèque ne peut pas trouver les fichiers requis pour fonctionner correctement.

Solution

Pour garantir le bon fonctionnement de l'installateur MSI, vous devez inclure les trois fichiers suivants dans votre projet de configuration : onnxruntime.dll, IronBarcodeInterop.dll et ReaderInterop.dll. Ces fichiers sont générés lorsque vous construisez le projet en mode Release :

  • onnxruntime.dll : Situé à MsiInstallerSample\MsiInstallerSample\bin\Release
  • IronBarcodeInterop.dll : Situé à MsiInstallerSample\MsiInstallerSample\bin\Release\runtimes\win-x86\native
  • ReaderInterop.dll : Situé à MsiInstallerSample\MsiInstallerSample\bin\Release\runtimes\win-x86\native

Assurez-vous que les trois fichiers sont ajoutés à votre projet d'installation pour éviter cette exception.

Curtis Chau détient un baccalauréat en informatique (Université de Carleton) et se spécialise dans le développement front-end avec expertise en Node.js, TypeScript, JavaScript et React. Passionné par la création d'interfaces utilisateur intuitives et esthétiquement plaisantes, Curtis aime travailler avec des frameworks modernes et créer des manuels bien structurés et visuellement attrayants.

Lire la suite

Prêt à commencer ?

Téléchargements NuGet 2,575,633Version :2026.11tout juste publié