Logo
Windows App Deployment Guide

Packaging Qt Apps with Inno Setup

A complete step-by-step workflow to deploy Qt dependencies using windeployqt and bundle them into a professional Windows installer (.exe) using Inno Setup Compiler.

Step 1: Prerequisites & Tools

Download and install the necessary deployment utilities

windeployqt (Qt 内置工具)

The official Qt deployment tool. It automatically copies required DLLs, plugins, and QML files to your executable's folder.

Path Configuration:

Included in your Qt installation (e.g., C:\Qt\6.5.0\mingw_64\bin). Ensure this path is in your System Environment Variables.

Inno Setup Compiler

A free, powerful installer builder for Windows. It uses simple script files (.iss) to create robust setup programs.

Step 2: Collect Dependencies (windeployqt)

Build in Release mode and isolate the necessary libraries

  1. In Qt Creator, switch your build profile to Release and build the project.
  2. Create a new clean folder (e.g., C:\AppDeploy).
  3. Copy the generated executable (e.g., MyApp.exe) into this new folder.
  4. Open CMD or PowerShell, and run the windeployqt tool:
Windows CMD / PowerShell
# Navigate to your deployment folder
cd C:\AppDeploy

# Run windeployqt on your executable
windeployqt MyApp.exe

# Note: If your project uses QML, you need to specify the qmldir path:
windeployqt --qmldir C:\Path\To\Your\Qml\Source MyApp.exe
At this point, you can double-click MyApp.exe in C:\AppDeploy. If it runs correctly without missing DLL errors, your dependencies are fully collected!

Step 3: Inno Setup Configuration Script (.iss)

Write the script to map your files to the Windows installer

Open Inno Setup Compiler. You can use the built-in Script Wizard, or click Cancel and create a new empty script pasting the example below. Save it as build.iss inside your deployment folder.

build.iss
[Setup]
; Basic App Information
AppName=My Amazing App
AppVersion=1.0.0
AppPublisher=My Company Name
; Default installation path (Program Files/MyAmazingApp)
DefaultDirName={autopf}\My Amazing App
; Start menu folder name
DefaultGroupName=My Amazing App
; Output directory and file name for the final installer
OutputDir=C:\AppDeploy\Output
OutputBaseFilename=MyApp_Setup_v1.0
; Compression settings (lzma2 is high compression)
Compression=lzma2/ultra64
SolidCompression=yes

[Tasks]
; Checkbox for creating desktop shortcut
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
; Specify the main executable first
Source: "C:\AppDeploy\MyApp.exe"; DestDir: "{app}"; Flags: ignoreversion
; Copy EVERYTHING else (DLLs, plugins, translations) recursively
Source: "C:\AppDeploy\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs

[Icons]
; Start Menu Icon
Name: "{group}\My Amazing App"; Filename: "{app}\MyApp.exe"
; Desktop Icon
Name: "{autodesktop}\My Amazing App"; Filename: "{app}\MyApp.exe"; Tasks: desktopicon

[Run]
; Launch option after successful installation
Filename: "{app}\MyApp.exe"; Description: "{cm:LaunchProgram,My Amazing App}"; Flags: nowait postinstall skipifsilent
Important Pathing Check: Ensure the Source paths (C:\AppDeploy\) precisely match where you collected your Qt dependencies in Step 2. Otherwise, the installer will build, but the app will crash upon launch due to missing DLLs.

Step 4: Compile the Installer

Build the setup.exe and test it locally

1. Run the Compiler

In Inno Setup, simply press F9 or click the 'Build -> Compile' button on the top menu bar. The software will begin compressing your entire folder into a single executable.

2. Grab Your Setup File

Once finished, navigate to C:\AppDeploy\Output. You will find your freshly baked MyApp_Setup_v1.0.exe! You can now distribute this single file to your users.