Creating a Minor Update MSI Manually

When to Use This Process

You can use the following process to create an MSI which will work for any of the following:

  • a clean (first-time) install,
  • a reinstall-in-place MSI upgrade,
  • or as the new/upgraded package used by the WPS Patch Creation tool in generating an MSP file.

I am assuming in this case that you have the original WSI or MSI file on hand, and the files, registry or INI file values and such that you want to update in the new package.

Step-by-Step

  1. If you have the original WSI file, copy the entire project directory to a new project directory, with the new version number or whatever. If you only have the old MSI file, then you’ll need to do an administrative install (“msiexec /a old.msi”) to the new project folder to extract all of the files, or better yet open the MSI with Windows Installer Editor (WIE) and choose to convert it to a WSI (“Tools” menu, “MSI to WSI Conversion…”).
  2. For files which exist in the old package, copy the newer versions over the old ones in the project path. In WIE’s “Setup Editor” pane, go to the “Tables” tab and select the “File” table. Locate the file you just replaced in the list, and make a mental note of the old file size (or version number, for DLLs, EXEs and such which have version numbers). Recompile the package and check the File table again to see if the new size or version was found. (Occasionally I’ve had problems with WIE not finding the new files, but for the most part it works fine.)
  3. For registry values which exist in the old package, you can change the values in place.
  4. If you have any new files or registry keys/values to add, you’re going to need to create a new feature and component(s) to hold them. Go to the “Setup Editor” pane and click the “Features” tab. Highlight the feature you want as the parent (most likely “Complete”, so that it’s installed with the normal default “Complete” installation), right-click and choose “New” | “Feature”. Here you can specify your new feature name, whether it’s visible or hidden, and so on.
  5. To add files to the new feature, let’s go back to the “Files” page of the “Installation Expert” pane. At the top of the page is a drop-down box labeled “Current Feature”. Before you add any files, make sure your new Feature is selected in the list. Thus, when you add new files in the GUI, WIE will automatically create new components for you that belong to your new Feature.
  6. To add new registry entries to the new feature, you can do pretty much the same thing as with the files from the “Registry” page of “Installation Expert”. Again, make sure you select your new Feature in the drop-down box at the top of the page before you add anything new. The same goes for INI file entries or other pages on the “Feature Details” section of the “Installation Expert” pane (“File Associations”, “Services”, etc.).
  7. Compile, and fix any errors as necessary.
  8. By now you probably know my mantra: test, test, test!

Now What?

For installing this package on machines which do not have the older version of the MSI, it should work fine with the normal install procedures.

For using this MSI to upgrade installations of the older MSI package, you’ll need to craft your reinstall command line carefully. (Note that you cannot use this reinstall command line to install the program for the first time, so don’t even try it.) You’ll want to use the “msiexec /f” option with the following options: ‘omus’ to reinstall or update just about everything in the package, ‘v’ to re-cache the package from the new MSI source file (otherwise, the PC will certainly use its own cached copy of the old MSI, which doesn’t have any of the new changes). Make sure to use the path to your new MSI and not the program GUI when you use the ‘/fv’ option. Lastly, if you have a new feature, you probably want to use the ‘ADDLOCAL’ property to tell the PC to add the new stuff. Altogether, this makes the command line look something like this:

msiexec /fvomus path_to\your\new.msi ADDLOCAL="NewFeature"

If you want to create an MSP to upgrade PCs with the old version of the MSI, you can use the MSI you just created as the new/updated input file for the Patch Creation tool.