发布博文
随想
读书
音乐
其他
我想爱,想吃,还想在一瞬间变成天上半明半暗的云。
我想爱,想吃,还想在一瞬间变成天上半明半暗的云。
我想爱,想吃,还想在一瞬间变成天上半明半暗的云。
我想爱,想吃,还想在一瞬间变成天上半明半暗的云。

WiX Toolset - Passing MsBuild Variables to WiX

350
高光翔
2024-09-24 18:20

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 


Insert title here Insert title here
打  赏