How to Build a Windows MSI Installer with Microsoft Visual Studio

Before releasing a Windows software, which is not open-source, we have to package everything that we have done in a Windows installer. In this post, I’d like to share how to build a Windows MSI installer with Microsoft Visual Studio 2010.

Creating a Basic MSI Installer

Click Setup and Deployment, and choose Setup Project:

setup_project

Click OK and check the project layout:

project_done

Right-click the Application Folder to add a new folder WebTWAINDemo, and drag all Web TWAIN project files into the folder:

WebTWAINDemo

Change values of Author, Manufacturer and ProductName:

author

Build the project as release version:

build

Double-click the Setup1.msi to launch Setup Wizard:

install

Now, you can verify whether the application has been successfully installed to the target folder.

Writing Values to Windows Registry

When installing applications, some important information needs to be written into Windows Registry. Let’s click registry editor, and create Dynamsoft->WebTWAINDemo->Version 1.0.0.0:

registry

Build the project, and launch the installer. After finishing installation, check the registry values:

webtwaindemo_registry

The version data has been created. If you run the installer to remove the application, all registered information will also be deleted from Windows Registry. Note: if some resources are still in use, it may fail to clean the Windows Registry.

Editing User Interface

It’s pretty easy to customize the user interface for installation process. Click the button User Interface Editor, and add dialogs you like:

UI

Common Errors When Running a Windows MSI Installer

  1. Same product codeerror_productcode
  2. Same version numbererror_version
  3. Running 64-bit installer on 32-bit Windows.error_system