Skip to content

[WIP] Migrate to WiX 5 #117010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
@@ -282,5 +282,12 @@
<NodePackageVersion>$(runtimewinx64MicrosoftNETCoreRuntimeWasmNodeTransportPackageVersion)</NodePackageVersion>
<!-- The package path for python in src/mono/mono.proj needs to be updated if this changes-->
<EmsdkVersion>3.1.56</EmsdkVersion>
<!-- WiX 5+ dependencies for MSI generation -->
<MicrosoftWixVersion>5.0.2-dotnet.2729052</MicrosoftWixVersion>
<MicrosoftWixToolsetUIWixextVersion>5.0.2-dotnet.2729052</MicrosoftWixToolsetUIWixextVersion>
<MicrosoftWixToolsetDependencyWixextVersion>5.0.2-dotnet.2729052</MicrosoftWixToolsetDependencyWixextVersion>
<MicrosoftWixToolsetUtilWixextVersion>5.0.2-dotnet.2729052</MicrosoftWixToolsetUtilWixextVersion>
<MicrosoftWixToolsetBalWixextVersion>5.0.2-dotnet.2729052</MicrosoftWixToolsetBalWixextVersion>
<MicrosoftWixToolsetHeatVersion>5.0.2-dotnet.2729052</MicrosoftWixToolsetHeatVersion>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -16,9 +16,18 @@
<MacOSBundleTemplate>$(MSBuildProjectDirectory)/shared-framework-distribution-template-$(TargetArchitecture).xml</MacOSBundleTemplate>
<MacOSBundleIdentifierName>com.microsoft.dotnet.Microsoft.NETCore.App.$(ProductVersion).osx.$(TargetArchitecture)</MacOSBundleIdentifierName>
<MacOSBundleResourcesPath>osx_resources</MacOSBundleResourcesPath>
<UseWix5>true</UseWix5>
</PropertyGroup>

<ItemGroup>
<!-- Microsoft.Wix is a dotnet tool package, so exlude its assets. -->
<PackageReference Include="Microsoft.Wix" Version="$(MicrosoftWixVersion)" ExcludeAssets="all" />
<!-- Installers needs the $(PkgMicrosoftWixToolsetUIwixext) property to locate the extension. -->
<PackageReference Include="Microsoft.WixToolset.UI.wixext" Version="$(MicrosoftWixToolsetUIWixextVersion)" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.WixToolset.Dependency.wixext" Version="$(MicrosoftWixToolsetDependencyWixextVersion)" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.WixToolset.Util.wixext" Version="$(MicrosoftWixToolsetUtilWixextVersion)" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.WixToolset.Bal.wixext" Version="$(MicrosoftWixToolsetBalWixextVersion)" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.WixToolset.Heat" Version="$(MicrosoftWixToolsetHeatVersion)" />
<PackageReference Condition="'$(BuildOnlyPgoInstrumentedAssets)' != 'true'" Include="Microsoft.DotNet.Build.Tasks.Installers" Version="$(MicrosoftDotNetBuildTasksInstallersVersion)" />
<PackageReference Include="Microsoft.DotNet.Build.Tasks.Archives" Version="$(MicrosoftDotNetBuildTasksArchivesVersion)" />
</ItemGroup>
1 change: 1 addition & 0 deletions src/installer/pkg/sfx/installers/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -4,5 +4,6 @@
<PropertyGroup>
<BuildDebPackage Condition="'$(TargetsLinuxGlibc)' == 'true'">true</BuildDebPackage>
<BuildRpmPackage Condition="'$(TargetsLinuxGlibc)' == 'true'">true</BuildRpmPackage>
<UseWix5>true</UseWix5>
</PropertyGroup>
</Project>
11 changes: 11 additions & 0 deletions src/installer/pkg/sfx/installers/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -2,6 +2,17 @@
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.Build.Tasks.Installers" Version="$(MicrosoftDotNetBuildTasksInstallersVersion)" />
</ItemGroup>

<ItemGroup Condition="'$(UseWix5)' == 'true'">
<!-- Microsoft.Wix is a dotnet tool package, so exlude its assets. -->
<PackageReference Include="Microsoft.Wix" Version="$(MicrosoftWixVersion)" ExcludeAssets="all" />
<!-- Installers needs the $(PkgMicrosoftWixToolsetUIwixext) property to locate the extension. -->
<PackageReference Include="Microsoft.WixToolset.UI.wixext" Version="$(MicrosoftWixToolsetUIWixextVersion)" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.WixToolset.Dependency.wixext" Version="$(MicrosoftWixToolsetDependencyWixextVersion)" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.WixToolset.Util.wixext" Version="$(MicrosoftWixToolsetUtilWixextVersion)" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.WixToolset.Bal.wixext" Version="$(MicrosoftWixToolsetBalWixextVersion)" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.WixToolset.Heat" Version="$(MicrosoftWixToolsetHeatVersion)" />
</ItemGroup>

<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets, $(MSBuildThisFileDirectory)..))" />
</Project>
40 changes: 25 additions & 15 deletions src/installer/pkg/sfx/installers/host.wxs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">

<?include "$(var.SharedWixDir)\variables.wxi" ?>

@@ -26,33 +25,46 @@
</File>
</Component>

<Component Id="cmpSharedHostVersionRegistry" Directory="DOTNETHOME" Guid="*">
<Component Id="cmpSharedHostVersionRegistry" Directory="DOTNETHOME">
<RegistryKey Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\$(var.Platform)\sharedhost">
<RegistryValue KeyPath="yes" Action="write" Name="Version" Type="string" Value="$(var.NugetVersion)"/>
</RegistryKey>
</Component>

<Component Id="cmpInstallLocation" Directory="TARGETDIR" Guid="*" Win64="no">
<Component Id="cmpInstallLocation" Directory="TARGETDIR" Bitness="always32">
<RegistryKey Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\$(var.Platform)">
<RegistryValue Action="write" Name="InstallLocation" Type="string" Value="[DOTNETHOME]" KeyPath="yes"/>
</RegistryKey>
</Component>

<?if $(var.Platform)~=x64 ?>
<!-- For x64 installer, only add to PATH when actually on native architecture -->
<Component Id="cmdPath" Directory="DOTNETHOME" Guid="*" Condition="NON_NATIVE_ARCHITECTURE">
<!-- A stable keypath with the right SxS characteristics for our PATH entry-->
<RegistryKey Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\$(var.Platform)\sharedhost">
<RegistryValue KeyPath="yes" Action="write" Name="Path" Type="string" Value="[DOTNETHOME]"/>
</RegistryKey>
<Environment Id="E_PATH" Name="PATH" Value="[DOTNETHOME]" Part="last" Action="set" System="yes" />
</Component>
<?elseif $(var.Platform)~=x86 ?>
<!-- For x86 installer, only add to PATH when not on 64-bit platform -->
<Component Id="cmdPath" Directory="DOTNETHOME" Guid="*" Condition="NOT VersionNT64">
<!-- A stable keypath with the right SxS characteristics for our PATH entry-->
<RegistryKey Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\$(var.Platform)\sharedhost">
<RegistryValue KeyPath="yes" Action="write" Name="Path" Type="string" Value="[DOTNETHOME]"/>
</RegistryKey>
<Environment Id="E_PATH" Name="PATH" Value="[DOTNETHOME]" Part="last" Action="set" System="yes" />
</Component>
<?else?>
<!-- TODO Is this case needed? -->
<Component Id="cmdPath" Directory="DOTNETHOME" Guid="*">
<?if $(var.Platform)~=x64 ?>
<!-- For x64 installer, only add to PATH when actually on native architecture -->
<Condition>NOT NON_NATIVE_ARCHITECTURE</Condition>
<?elseif $(var.Platform)~=x86 ?>
<!-- For x86 installer, only add to PATH when not on 64-bit platform -->
<Condition>NOT VersionNT64</Condition>
<?endif?>

<!-- A stable keypath with the right SxS characteristics for our PATH entry-->
<RegistryKey Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\$(var.Platform)\sharedhost">
<RegistryValue KeyPath="yes" Action="write" Name="Path" Type="string" Value="[DOTNETHOME]"/>
</RegistryKey>
<Environment Id="E_PATH" Name="PATH" Value="[DOTNETHOME]" Part="last" Action="set" System="yes" />
</Component>
<?endif?>

<Component Id="cmpLicenseFiles" Directory="DOTNETHOME" Guid="{A61CBE5B-1282-4F29-90AD-63597AA2372E}">
<File Id="fileLicenseTxt" KeyPath="yes" Source="$(var.HostSrc)\LICENSE.txt">
@@ -79,8 +91,6 @@

<Fragment>
<!-- Unlike DOTNETHOME which gives precedence to a user specified value over an x64 suffix, here we always want the suffixed path -->
<SetProperty Action="Set_PROGRAMFILES_DOTNET_NON_NATIVE_ARCHITECTURE" Id="PROGRAMFILES_DOTNET" Value="[$(var.Program_Files)]dotnet\x64\" After="Set_NON_NATIVE_ARCHITECTURE">
NON_NATIVE_ARCHITECTURE
</SetProperty>
<SetProperty Action="Set_PROGRAMFILES_DOTNET_NON_NATIVE_ARCHITECTURE" Id="PROGRAMFILES_DOTNET" Value="[$(var.Program_Files)]dotnet\x64\" After="Set_NON_NATIVE_ARCHITECTURE" Condition="NON_NATIVE_ARCHITECTURE" />
</Fragment>
</Wix>