Home > Windows Development > Deployment with IExpress: How to turn your MSI file into an EXE

Deployment with IExpress: How to turn your MSI file into an EXE

September 22, 2012 Leave a comment Go to comments

I have no problem with MSI file downloads. They are as simple as running an EXE. However, for reasons unknown, a lot of people don’t seem to like or understand downloading and running an MSI file; they feel more comfortable with EXEs. Visual Studio Setup projects turn your application into an MSI and a setup.exe file, which is inconvenient for distribution as generally online we want to provide the user with a single file download. Luckily there is a simple and free solution at hand in the guise of a quirky and little-known application included even as late as the Windows 7 base distribution called IExpress. This tool was originally created to enable branded deployments of Internet Explorer 6 (shocking, I know), but we can subvert it quite easily to our needs.

On the first build, we’ll need to create a SED file which defines how IExpress will perform the build. Bring up a command prompt or press START+R, type IExpress and press Enter to get the ball rolling.

Figure 1. IExpress welcome screen

Choose the following options on the next screens:

  • Create new Self Extraction Directive file
  • Extract files and run an installation command
  • Enter the friendly name of your application on the ‘Package title’ screen
  • No prompt (on Confirmation prompt screen)
  • Do not display a license (this is unnecessary as the MSI installer will display your license agreement already)
  • On the ‘Packaged files’ screen, click Add and choose only the MSI file created from your Visual Studio Setup project. Click Next.
  • On the ‘Install Program to Launch’ screen, leave the Post Install Command blank and enter the following as the Install Program: msiexec /i NameOfYourSetupFile.msi
  • Choose ‘Default (recommended)’ on the ‘Show window’ screen
  • Choose ‘No message’ on the ‘Finished message’ screen
  • Enter a fileame for your target EXE, leave ‘Hide File Extracting Progress Animation from User’ unticked, but tick ‘Store files using Long File Name inside Package’ so that your filenames don’t get corrupted. You will get a warning when you tick this – click Yes to ignore it. You should set the target path for your EXE into the Release (or Debug) folder of your Visual Studio Setup project, ie. the same folder where the MSI file is created by Visual Studio.
  • Choose ‘No restart’ (once again your MSI will prompt the user to do this if needed)
  • Now save your SED file into the same folder as your Visual Studio Setup project (where your .vdproj file is located). It’s crucial you don’t save it into the Debug or Release sub-folders as the SED will get deleted without prompting when you re-build the Setup project if you do this.
  • The package will now build. Check that it works.

Automation

For bonus points, we want to automate this when building the Setup project.

Figure 2. Setting the post-build event in the Visual Studio Setup project.

  • Right click on the Setup project node in Visual Studio and choose Properties.
  • Change the PostBuildEvent property as follows:

cd $(ProjectDir)
iexpress /N /Q NameOfSedFile.SED

  • Change the RunPostBuildEvent property to On successful build. This will ensure that IExpress only runs when the Setup project build completed without errors.

And there you have it. Building your Setup project in Visual Studio should now produce a single EXE file at the end of the build which you can deploy on your web site or other distribution media!

Advertisements
  1. Anonymous
    January 10, 2013 at 12:18

    thank your article

  2. April 14, 2014 at 08:03
  1. No trackbacks yet.

Share your thoughts! Note: to post source code, enclose it in [code lang=...] [/code] tags. Valid values for 'lang' are cpp, csharp, xml, javascript, php etc. To post compiler errors or other text that is best read monospaced, use 'text' as the value for lang.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: