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.
-
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 themove
command to be able to force overwrites. -
First, set the proper output name in the Wix project options; I like to use the 'Install [name]' format:
-
Next, add the rename script to the post-build options:
-
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.0.0.0.msi" 1> 1 file(s) moved.
And in the output directory: