DEV Community

YASH MAISURIYA
YASH MAISURIYA

Posted on

๐Ÿš€ Building a Custom Windows Installer with Inno Setup for WPF Applications ๐Ÿ’ปโœจ

After completing my WPF application, it was time to wrap it up in a clean, user-friendly installer. Like many developers, I initially turned to Visual Studioโ€™s Setup Wizard (Setup Project). While it gets the job done for basic packaging, I quickly ran into its limitations โ€” especially when it came to customization.

Hereโ€™s a quick overview of why I made the switch, what I needed, and how Inno Setup gave me the flexibility I was looking for.

๐Ÿค” Why I Left the Setup Wizard Behind
Initially, I used the built-in Setup Wizard provided by Visual Studio. Itโ€™s a drag-and-drop experience thatโ€™s great for simple installers, but here's what I couldnโ€™t do with it:

  • โŒ No option to create a desktop shortcut
  • โŒ No way to auto-launch the application after installation
  • โŒ No custom branding or installation logic
  • โŒ Limited control over registry entries and version checks

I needed more โ€” something that would allow me to create a polished, professional installer. Thatโ€™s when I discovered Inno Setup.

โœ… What I Achieved with Inno Setup:

  • โœ… Created desktop & Start Menu shortcuts
  • โœ… Launched app after installation
  • โœ… Added registry keys for license/trial handling
  • โœ… Branded the installer with a custom icon and app name
  • โœ… Controlled version checks and clean uninstall support

๐Ÿ”ง Brief Explanation of the Installer Script
This Inno Setup script creates a custom Windows installer for testApplication. Here's a breakdown of its key components:

  • [Setup]: Defines the application name, version, output file, privileges, and installer behavior (like compression and icon).
  • [Languages]: Adds support for English language messages.
  • [Files]: Includes:
    • The main .exe, .dll, and .config files.
    • SQLite-specific files like SQLite.Interop.dll.
    • Additional resources like images and default songs.
    • Temporary files like EULA and Terms text.
  • [Icons]: Adds Start Menu and Desktop shortcuts (controlled by user selection).
  • [Run]: Optionally runs the application after installation.
  • [Code]:
    • Adds custom wizard pages for Terms & Conditions, License Agreement, and Install Options.
    • Provides checkboxes for:
      • Accepting license terms.
      • Creating desktop shortcuts.
      • Running the app post-install.
    • Validates if the license checkbox is checked before proceeding.

๐Ÿ“ Full Script on GitHub Gist:
https://github.com/YashMaisuirya13/InnoScriptWpf.git

๐Ÿ’กPro Tips
๐Ÿ› ๏ธ Use Inno Script Studio or ISTool for a more visual experience when editing scripts.
๐Ÿ“ {app} is a helpful macro that points to the installation directory.
๐Ÿง  Use the [Code] section for advanced logic like checking existing versions or validating registry keys.
๐Ÿงช Always test your installer in a clean VM or sandbox environment.

With Inno Setup, I was finally able to deliver an installer that matched the polish and professionalism of the application itself.

Let me know if youโ€™d like help building your own installer!

Image description

Top comments (0)