Creating a MSI Installer with IronBarCode

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

An MSI (Microsoft Installer) is a Windows installation package that facilitates the management of software installation, updates, and removal. Using an MSI provides a standardized method for installing applications, which is especially beneficial for enterprise-level deployments.

IronBarCode offers tools to seamlessly integrate with your existing application and convert it into an MSI for easy distribution. It ensures reliable installation across various environments and allows developers to select which components to include or exclude.

This tutorial will briefly demonstrate how to create an MSI file from an example barcode application.

Quickstart: Generate and Read an MSI Barcode in a Click

Use IronBarcode’s simple API to both create and read MSI barcodes with minimal setup. The snippet below shows how easy it is to write an MSI barcode image, then read it back—all in just a couple of lines.

Nuget IconGet started making PDFs with NuGet now:

  1. Install IronBarcode with NuGet Package Manager

    PM > Install-Package BarCode

  2. Copy and run this code snippet.

    var msiImg = IronBarCode.BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.MSI).SaveAsImage("msi.png");
    var results = IronBarCode.BarcodeReader.Read("msi.png", new BarcodeReaderOptions { ExpectBarcodeTypes = BarcodeEncoding.MSI });
  3. Deploy to test on your live environment

    Start using IronBarcode in your project today with a free trial
    arrow pointer

Comience a usar IronBarcode en su proyecto hoy con una prueba gratuita.

Primer Paso:
green arrow pointer

Prerequsites

Before we start on the project, please download the Microsoft Visual Studio Installer Projects extension for the MSI build to work.

Create a MSI Installer

We'll use a Windows Forms App (.NET Framework) project to demonstrate its functionality for this example.

Add a Button

  • Navigate to the ToolBox
  • Search for Button
  • Add the button by drag and down onto the windows form.

Add button

Edit the Button Code

Double click on the button component to access the C# code of the form. Below is the logic for the form component, it takes in a barcode and attempts to scan it. This code only scan image and does not work for PDF. Use the ReadPdf method for PDF document.

using IronBarCode;
using IronSoftware.Drawing;
using System;
using System.Drawing;
using System.Windows.Forms;

namespace MsiInstallerSample
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            IronSoftware.Logger.LoggingMode = IronSoftware.Logger.LoggingModes.All;
            IronSoftware.Logger.LogFilePath = "Default.log";

            IronBarCode.License.LicenseKey = "IRONBARCODE-MYLICENSE-KEY-1EF01";

            using (OpenFileDialog openFileDialog = new OpenFileDialog())
            {
                openFileDialog.Filter = "Image files (All files (*.*)|*.*";

                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        // Load the selected image
                        using (Bitmap bmp = new Bitmap(openFileDialog.FileName))
                        {
                            // Process the image
                            AnyBitmap anyBitmap = AnyBitmap.FromBitmap(bmp);

                            // Configure barcode reader options (customize as needed)
                            var option = new BarcodeReaderOptions
                            {
                                Speed = ReadingSpeed.Detailed,
                                ExpectMultipleBarcodes = true,
                                ScanMode = BarcodeScanMode.Auto,
                            };

                            BarcodeResults result = IronBarCode.BarcodeReader.Read(anyBitmap, option);

                            if (result.Count > 0)
                            {
                                string output = string.Empty;
                                foreach(var barcode in result)
                                {
                                    Console.WriteLine($"Barcode Found: {barcode.Text}");
                                    output += barcode.Text + "\n";
                                }

                                MessageBox.Show($"Detected Barcodes: \n{output}");
                            }
                            else
                            {
                                MessageBox.Show("No Barcode found.");
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show($"{ex.Message}");
                    }
                }
            }
        }
    }
}
using IronBarCode;
using IronSoftware.Drawing;
using System;
using System.Drawing;
using System.Windows.Forms;

namespace MsiInstallerSample
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            IronSoftware.Logger.LoggingMode = IronSoftware.Logger.LoggingModes.All;
            IronSoftware.Logger.LogFilePath = "Default.log";

            IronBarCode.License.LicenseKey = "IRONBARCODE-MYLICENSE-KEY-1EF01";

            using (OpenFileDialog openFileDialog = new OpenFileDialog())
            {
                openFileDialog.Filter = "Image files (All files (*.*)|*.*";

                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        // Load the selected image
                        using (Bitmap bmp = new Bitmap(openFileDialog.FileName))
                        {
                            // Process the image
                            AnyBitmap anyBitmap = AnyBitmap.FromBitmap(bmp);

                            // Configure barcode reader options (customize as needed)
                            var option = new BarcodeReaderOptions
                            {
                                Speed = ReadingSpeed.Detailed,
                                ExpectMultipleBarcodes = true,
                                ScanMode = BarcodeScanMode.Auto,
                            };

                            BarcodeResults result = IronBarCode.BarcodeReader.Read(anyBitmap, option);

                            if (result.Count > 0)
                            {
                                string output = string.Empty;
                                foreach(var barcode in result)
                                {
                                    Console.WriteLine($"Barcode Found: {barcode.Text}");
                                    output += barcode.Text + "\n";
                                }

                                MessageBox.Show($"Detected Barcodes: \n{output}");
                            }
                            else
                            {
                                MessageBox.Show("No Barcode found.");
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show($"{ex.Message}");
                    }
                }
            }
        }
    }
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

Adding a Setup Project

After setting up the form and its controller logic, we need to add a Setup Project to the existing solution to create an MSI installer. The Setup Project allows us to build an installer for the application we just created.

Right-click on the solution, then go to Add > New Project...

Add Setup Project

For the MSI installer, build the MsiInstallerSample project again in Release mode. Right-click on the Setup Project, then go to Add > Project Output...

Add project output

To ensure the MSI installer runs smoothly, you must include the following three files in your setup project: onnxruntime.dll, IronBarcodeInterop.dll, and ReaderInterop.dll. These files are generated when you build the project in Release mode:

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

Add additional DLLs

If any of these files is missing, you may encounter the following exception message, as noted in this troubleshooting article: Missing DLLs in Creating MSI Installer

Finally, build the Setup Project. The installer will be located at: MsiInstallerSample\SetupProject\Release

Run & Test the Installer

We install the application with the MSI file to ensure everything is running smoothly.

Demonstration related to Run & Test the Installer

Download MSI Installer Sample Project

You can download the complete code for this guide. It comes as a zipped file that you can open in Visual Studio as a WinFormApp project.

Download the WinForm MSI App Project

Preguntas Frecuentes

¿Qué es IronBarCode?

IronBarCode es una biblioteca que permite a los desarrolladores leer, escribir y generar códigos de barras en aplicaciones .NET. Soporta una amplia gama de formatos de códigos de barras y está diseñado para una fácil integración.

¿Cómo puedo crear un instalador MSI con IronBarCode?

Para crear un instalador MSI con IronBarCode, necesita integrar la biblioteca de IronBarCode en su aplicación y seguir los procedimientos estándar para crear un instalador MSI utilizando herramientas como Visual Studio Installer Projects.

¿Cuáles son los beneficios de usar IronBarCode en un instalador MSI?

Integrar IronBarCode en un instalador MSI simplifica el proceso de despliegue de aplicaciones que requieren funcionalidad de códigos de barras, asegurando que todos los componentes necesarios se instalen correctamente en el sistema del usuario final.

¿Qué formatos de código de barras son compatibles con IronBarCode?

IronBarCode es compatible con una amplia gama de formatos de códigos de barras, incluidos códigos QR, UPC, EAN, Code 39, Code 128 y más, haciéndolo versátil para diversas necesidades de aplicación.

¿Es posible personalizar la apariencia de un código de barras con IronBarCode?

Sí, IronBarCode permite la personalización de la apariencia de los códigos de barras, incluyendo colores, tamaños y anotaciones de texto, para ajustarse a los requisitos de diseño específicos de su aplicación.

¿Necesito herramientas específicas para integrar IronBarCode en un instalador MSI?

Puede usar herramientas de desarrollo comunes como Visual Studio para integrar IronBarCode en su aplicación y crear un instalador MSI. La biblioteca de IronBarCode es compatible con .NET, lo que la hace accesible para desarrolladores que utilizan este marco.

¿Puede IronBarCode leer y escribir códigos de barras 2D?

Sí, IronBarCode puede leer y escribir tanto códigos de barras 1D como 2D, incluidos códigos QR, Data Matrix y otros, proporcionando funcionalidades completas de códigos de barras.

¿Cuáles son los requisitos del sistema para usar IronBarCode?

IronBarCode requiere un entorno de marco .NET para funcionar. Es compatible con .NET Core, .NET 5/6 y versiones anteriores, asegurando una amplia compatibilidad en diferentes proyectos.

¿Cómo empiezo con IronBarCode?

Para comenzar con IronBarCode, puede descargar la biblioteca desde el sitio web de Iron Software, revisar la documentación e integrarla en su proyecto .NET siguiendo los ejemplos y pautas proporcionados.

¿Está disponible el soporte técnico para usuarios de IronBarCode?

Sí, Iron Software proporciona soporte técnico para usuarios de IronBarCode, incluyendo documentación, tutoriales y opciones de soporte directo para asistir con problemas de integración y uso.

Curtis Chau
Escritor Técnico

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 ...

Leer más
¿Listo para empezar?
Nuget Descargas 1,935,276 | Versión: 2025.11 recién lanzado