Automatically update version information in wix installer

Hi, I have a C / C ++ header file with my init product version information:

#define nMajorVersion 4 #define nMinorVersion 4 #define nPointVersion 8 #define nBuildVersion 33 #define s_szFileVersion "4.4.8.33" #define s_szProductVersion "4.4.8.33" 

Is there a way that I can automatically read from this file to update my version number in my wix 3.6 installer? At the moment I have it hardcoded, and it is not ideal for when it will be released. Thanks

+4
source share
1 answer

What you can do is create a c / C ++ program that generates a Version.wxi file that looks like this:

 <?xml version="1.0" encoding="utf-8"?> <Include> <?define ProductVersion.Major="4"?> <?define ProductVersion.Minor="4"?> <?define ProductVersion.Revision="8"?> <?define ProductVersion.Build="33"?> <?define ProductVersion="4.4.8.33"?> .... </Include> 

You can then enable and use these version numbers in the main wxs file:

 <?xml version="1.0" encoding="UTF-8"?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <?include Version.wxi ?> <?define UpgradeCode="GUID"?> <Product Id="*" Name="$(var.ProductName) $(var.ProductVersion.Major).$(var.ProductVersion.Minor)" Version="$(var.ProductVersion)" Language="1033" Manufacturer="$(var.Company)" UpgradeCode="$(var.UpgradeCode)"> 

Create Version.wxi just before compiling your wix project. For example, modify the .wixproj file to add a target that does this.

+4
source

Source: https://habr.com/ru/post/1433393/


All Articles