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.
Included in your Qt installation (e.g., C:\Qt\6.5.0\mingw_64\bin). Ensure this path is in your System Environment Variables.
Step 2: Collect Dependencies (windeployqt)
Build in Release mode and isolate the necessary libraries
- In Qt Creator, switch your build profile to Release and build the project.
- Create a new clean folder (e.g.,
C:\AppDeploy). - Copy the generated executable (e.g., MyApp.exe) into this new folder.
- Open CMD or PowerShell, and run the windeployqt tool:
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.
Step 4: Compile the Installer
Build the setup.exe and test it locally
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.
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.
