Skip to content

Commit 2f61171

Browse files
authored
Build break: Shorten Windows targeting pack CAB name (#29605)
- use `<MediaTemplate>` and auto-generated name when embedding - otherwise, stick with `<Media>` but remove `_win` from the CAB name
1 parent fdc8822 commit 2f61171

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

eng/targets/Wix.Common.targets

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,24 @@
2727
<OutputName Condition="'$(OutputNamePrefix)' != '' AND '$(OutputNameSuffix)' != ''">$(OutputNamePrefix)$(_GeneratedPackageVersion)$(OutputNameSuffix)</OutputName>
2828

2929
<EmbedCab Condition="'$(EmbedCab)' == ''">yes</EmbedCab>
30-
<Cabinet Condition="'$(Cabinet)' == ''">$(OutputName.Replace('-', '_')).cab</Cabinet>
3130
<InstallDir>$(ProductName)</InstallDir>
3231

3332
<DefineConstants Condition="'$(Configuration)' == 'Debug'">$(DefineConstants);Debug</DefineConstants>
3433
<DefineConstants>$(DefineConstants);EmbedCab=$(EmbedCab)</DefineConstants>
35-
<DefineConstants>$(DefineConstants);Cabinet=$(Cabinet)</DefineConstants>
34+
</PropertyGroup>
35+
36+
<PropertyGroup Condition=" '$(OutputType)' == 'package' AND '$(Cabinet)' == '' ">
37+
<Cabinet>$(OutputName.Replace('-', '_')).cab</Cabinet>
38+
<Cabinet Condition=" '$(EmbedCab)' != 'yes' ">$(OutputName.Replace('_win', '')).cab</Cabinet>
3639
</PropertyGroup>
3740

3841
<PropertyGroup>
3942
<Culture Condition=" '$(Culture)' == '' ">en-US</Culture>
4043
<Cultures Condition=" '$(Cultures)' == '' ">$(Culture)</Cultures>
4144
<InstallerPlatform>$(Platform)</InstallerPlatform>
4245
<OutDir Condition=" '$(OutDir)' == '' ">$(OutputPath)</OutDir>
46+
47+
<DefineConstants>$(DefineConstants);Cabinet=$(Cabinet)</DefineConstants>
4348
<DefineConstants>$(DefineConstants);BinPath=$(OutputPath)$(Culture)\</DefineConstants>
4449
<DefineConstants>$(WixVariables);$(DefineConstants)</DefineConstants>
4550
</PropertyGroup>

src/Installers/Windows/TargetingPack/Product.wxs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55
<Package InstallerVersion="$(var.InstallerVersion)" Compressed="yes" InstallScope="perMachine" />
66

77
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." Schedule="afterInstallFinalize" />
8-
<Media Id="1" Cabinet="$(var.Cabinet)" CompressionLevel="high" EmbedCab="$(var.EmbedCab)" />
8+
9+
<?if $(var.EmbedCab)=yes?>
10+
<!-- Ignore var.Cabinet This element should choose an appropriate name for the embedded CAB. -->
11+
<MediaTemplate CompressionLevel="high" EmbedCab="yes" />
12+
<?else?>
13+
<Media Id="1" Cabinet="$(var.Cabinet)" CompressionLevel="high" EmbedCab="no" />
14+
<?endif?>
915

1016
<WixVariable Id="WixUILicenseRtf" Value="$(var.files)\eula.rtf" />
1117
<UIRef Id="WixUI_Minimal" />

0 commit comments

Comments
 (0)