Click here to Skip to main content
14,545,060 members

EXE to MSI -- MSI Wrapper using WIX Toolset v4

Rate this:
2.27 (3 votes)
Please Sign up or sign in to vote.
2.27 (3 votes)
3 Sep 2018CPOL
WIX template for wrapping EXE with a MSI installer for easier deployment with group policy


Just wanted to share a template I used for creating an MSI installer around a simple EXE installer using WIX Toolset v4. By passing cmd line arguments to the EXE, we can perform the install silently and it will roll back if the EXE install is unsuccessful.


This is mostly information gathered from this site as well as other websites combined to give me what I needed. In this case, I needed to deploy inventory agents to all computers in my work company domain. I enjoy the ease of using windows group policy to deploy programs but you need an MSI installer to take advantage of this feature. So using Visual Studio 2017 and WIX Toolset v4\Visual Studio Extension, I was able to accomplish this.

I originally used this for Fusion Inventory Agent ( and made installers for the x64 and x86. Deploying the agents was simple after that, all agent settings were supplied with cmd arguments in the MSI installer. Tested on Windows 7/8/10.

Using the Code

Add your own custom icon for the uninstaller in the add\remove programs window.
Otherwise, remove the 2 lines referring to icon.

Make sure to add the EXE in the main project directory so it can be compressed into the new MSI installer file.

Copy this template to your wix project file and change all bold text below to match your values.

Build and test!

**Make sure to "run as administrator" and\or with "compatibility mode" when running the installer manually under Window 10.

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="">


                    Language="1033" Version=""

                    Manufacturer="company name"

    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
    <Media Id="1" Cabinet="" EmbedCab="yes" />

    <Icon Id="icon.ico" SourceFile="icon.ico" />
    <Property Id="ARPPRODUCTICON" Value="icon.ico" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <Feature Id="ProductFeature" Title="APPLICATION NAME MSI WRAPPER" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
            <ComponentRef Id="mysetup" />

    <CustomAction Id="mysetup" FileKey="setup.exe" ExeCommand='/COMMANDLINE-PARAMATERS /S' 

     Execute="deferred" Impersonate="yes" Return="check" />

        <Custom Action="mysetup" Sequence="5401">NOT Installed</Custom>
        <Directory Id="TARGETDIR" Name="SourceDir">
             <Directory Id="TempFolder" />
        <ComponentGroup Id="ProductComponents" Directory="TempFolder">
             <Component Id="mysetup" Guid="00000000-YOUR-GUID-bac606fc74a2">
                   <File Id="setup.exe" Source="YOUR-EXE-FILE.exe" />

Points of Interest

Any input appreciated.


  • 1st September, 2018: Initial version


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

No Biography provided

Comments and Discussions

Questionadditional information Pin
Nelek2-Sep-18 11:21
protectorNelek2-Sep-18 11:21 
SuggestionWrong type Pin
Afzaal Ahmad Zeeshan2-Sep-18 11:17
mvaAfzaal Ahmad Zeeshan2-Sep-18 11:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Posted 1 Sep 2018


2 bookmarked