Sometimes we want to pass some parameters to the WiX installation program. There is a very common requirements that, when the Pipeline build WiX project, we want to pass the build number to installation package, and display the version number in the title.
1.Define preprocessor variables
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> ... <DefineConstants>ProductVersion=$(ProductVersion)</DefineConstants> ... </PropertyGroup>
2.Add default value, if vraiable is set to empty when build
<PropertyGroup> ... <ProductVersion Condition="'$(ProductVersion)' == ''">1.1.1.0</ProductVersion> </PropertyGroup>
3.Build with parameter
msbuildArguments: '/p:ProductVersion=1.1.1.0'
Passing MsBuild Variables to Wix
Setting properties for WiX in MSBuild