Version in MSI filename

Strangely, the properties of MSI files don't show what product version they're for, which is a nice thing to be able to see at a glance. It's also a nice thing to not have to make a new directory for each archived installer of a product. In short, let's have Wix rename its output files to include the product version.

This tip can be nicely combined with Installer version = file version, version in product name. There's other methods out there, but this one's simple and doesn't involve editing the .wixproj file.

  1. Download the script and put it in a directory somewhere in your solution, for this example I'll put it in a 'Scripts' subdirectory.
    The script consists of a .bat and .vbs file. The .bat file takes an MSI file as its command-line parameter, calls the .vbs file to query that MSI's database for the version number, and then renames the file. It renames using the move command to be able to force overwrites.
  2. First, set the proper output name in the Wix project options; I like to use the 'Install [name]' format:
  3. Next, add the rename script to the post-build options:
  4. Done! The build output will now say
    1>		"E:\SetupProject1\\scripts\renamemsi.bat" "E:\SetupProject1\SetupProject1\bin\Release\Install MyProduct.msi"
    1>		Renaming to "E:\SetupProject1\SetupProject1\bin\Release\Install MyProduct"
    1>		        1 file(s) moved.
    And in the output directory: productname3
Created: Jan 21 2012
Modified: Jan 21 2012