How to convert MSI to EXE for free
Warning - this process is quite long. If you prefer, there is a tool to do this for you. To find out more, click here for the MSI to EXE compiler tool .
In this hub I will tell you how to convert your MSI to an EXE for free. There are some software utilities out there you have to pay for, but you don't need them. This method uses a utility built into Windows that can be run using a wizard or automated from the command line.
Why would you want to create an EXE from an MSI? Here are some reasons:
- Some people won't recognise what an .MSI is and what to do with it. And exe makes it more obvious you need to run it.
- The exe can do a special run of the .MSI using msiexec with certain parameters, e.g. quiet mode.
- If you use Visual Studio Setup Projects you need to supply both the setup.exe and setup.msi but you want to give your customers a single download.
- By making your download an .exe you have the flexibility to move away from .MSI later if you wish without updating your PAD files.
So now you know the reasons, lets do it!
The tool you will use
The tool to create the EXE file is built into Windows XP, Vista and Windows 7 and is called IExpress. It's an old tool few people know about. I only learned about this recently.
So lets get started. To begin:
- To begin, get a nice empty folder ready with your .msi file. (Don't worry about the small setup.exe if you have built using Visual Studio - we won't need that)
- Click Start->Run and type iexpress and press OK
- You will see the Welcome to IExpress window. Click Next.
- Package Purpose - stick with "Extract Files and run an installation command" and click Next.
- Package Title - Enter a suitable title, click Next.
- Confirmation Prompt - Stick with No Prompt, click Next
- License Agreement - Stick with Do not display (I presume you have one in the msi), click Next.
- Packaged Files - Click Add and choose your MSI file. Click Next.
- Install Program to Launch - Enter msiexec /i MyPacakage.msi *, changing the msi name as appropriate. Don't bother with post install. Click Next.
- Show Window - Keep with default. Click Next.
- Finished Message - Keep with no message. Click Next
- Package Name and options - Enter the full path** to where you want the package (.exe) created. Click Next
- Configure Restart - Stick with only restarted if needed. Click Next
- Save Self Extraction Directive - Choose to save the SED file into the same directory as the msi for later use.
- Create Package - Click Next to create it
Now the process will start and will create your self extracting .exe. Well done!
* If you just enter the .msi name here the install will fail with an obscure couldn't find dll error. You need to have this command to msiexec for this to work. Feel free to change the flags if you know what you are doing.
** If you don't put a full path it will choose a silly default
To find out more, click here for the MSI to EXE compiler tool .
Automate from the command line
Now you have saved the options as a .sed file, it is very easy to automate from the command line, so you can add this into your build scripts. I have this running after a script that builds the code and runs WiX to create the msi. So I have a complete end to end build and deploy process using free tools!
Firstly I will just mention what you can do with the .sed file. There is an option to open it in the IExpress wizard so you can edit it. You can also open it in notepad and edit the settings that way.
To automate, just create a new text file in your msi folder, rename to createexe.bat and edit it.
In the editor type:
IExpress /N MyFile.SED
(replacing MyFile with the file name you chose)
When you double click createexe.bat the whole process is done for you automatically. Ideal for version 1.1 of your software.