Thursday, April 18, 2013

WiX: How to read product version from .EXE or .DLL file

Let's assume that my program has MyCoolestApplication.exe as the main executable file name.

Using bind.FileVersion syntax I can define a VERSION variable that will automatically get product version from .EXE file:
<?xml version='1.0' encoding='windows-1252'?>

<?define PRODUCT="My coolest application"?>
<?define VERSION=!(bind.FileVersion.MyCoolestApplication.exe)?>

<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>

    <Product Name='$(var.PRODUCT) $(var.VERSION)' Version='$(var.VERSION)' Id='NNNNNNNN-NNNN-NNNN-NNNN-NNNNNNNNNNNN'
        UpgradeCode='NNNNNNNN-NNNN-NNNN-NNNN-NNNNNNNNNNNN' Language='1033' Codepage='1252' Manufacturer='Vurdalakov'>

    ...

1 comment: