dotnet-installer/src/redist/targets/packaging/windows/clisdk/bundle.wxs
2023-08-02 14:54:48 -07:00

259 lines
13 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
xmlns:swid="http://schemas.microsoft.com/wix/TagExtension"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<?include "Variables.wxi" ?>
<Bundle Name="$(var.ProductName)" Manufacturer="$(var.Manufacturer)"
Version="$(var.SDKBundleVersion)" UpgradeCode="$(var.UpgradeCode)"
AboutUrl="https://aka.ms/netcorehelp/"
Compressed="yes">
<bal:Condition Message="#(loc.InstallPathx64x86)">
WixBundleInstalled OR (NOT DOTNETHOME_X64 ~= DOTNETHOME_X86) OR DOTNETHOMESIMILARITYCHECKOVERRIDE
</bal:Condition>
<bal:Condition Message="#(loc.InstallPathARM64x86)">
WixBundleInstalled OR (NOT DOTNETHOME_ARM64 ~= DOTNETHOME_X86) OR DOTNETHOMESIMILARITYCHECKOVERRIDE
</bal:Condition>
<!-- Permit same path on non-ARM64 machines since past SDKs always wrote this value -->
<bal:Condition Message="#(loc.InstallPathARM64x64)">
WixBundleInstalled OR (NOT DOTNETHOME_ARM64 ~= DOTNETHOME_X64) OR (NOT NativeMachine=&quot;$(var.NativeMachine_arm64)&quot;) OR DOTNETHOMESIMILARITYCHECKOVERRIDE
</bal:Condition>
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.Foundation">
<bal:WixStandardBootstrapperApplication
LicenseFile="dummyeula.rtf"
SuppressDowngradeFailure="yes"
ShowFilesInUse="yes"
ShowVersion="yes" />
<PayloadGroupRef Id="DotnetCoreBAPayloads" />
</BootstrapperApplicationRef>
<swid:Tag Regid="microsoft.com" InstallPath="[$(var.Program_Files)]dotnet" />
<util:RegistrySearch Id="CheckDotnetInstallLocation_x86"
Variable="DotnetInstallLocationExists_x86"
Result="exists"
Root="HKLM"
Key="SOFTWARE\dotnet\Setup\InstalledVersions\x86"
Value="InstallLocation" />
<util:RegistrySearch Id="DotnetInstallLocation_x86"
After="CheckDotnetInstallLocation_x86"
Condition="DotnetInstallLocationExists_x86"
Variable="DOTNETHOME_X86"
Result="value"
Root="HKLM"
Key="SOFTWARE\dotnet\Setup\InstalledVersions\x86"
Value="InstallLocation" />
<util:FileSearch Id="DotnetExeSearch_x86"
After="DotnetInstallLocation_x86"
Variable="DotnetExeExists_x86"
Condition="NOT DotnetInstallLocationExists_x86"
Result="exists"
Path="[ProgramFilesFolder]dotnet\dotnet.exe"/>
<util:DirectorySearch Id="DotnetExeLocation_x86"
After="DotnetExeSearch_x86"
Condition="DotnetExeExists_x86"
Variable="DOTNETHOME_X86"
Path="[ProgramFilesFolder]dotnet"/>
<?if $(var.Platform)!=x86?>
<util:RegistrySearch Id="CheckDotnetInstallLocation_x64"
Variable="DotnetInstallLocationExists_x64"
Result="exists"
Root="HKLM"
Key="SOFTWARE\dotnet\Setup\InstalledVersions\x64"
Value="InstallLocation" />
<util:RegistrySearch Id="DotnetInstallLocation_x64"
After="CheckDotnetInstallLocation_x64"
Condition="DotnetInstallLocationExists_x64"
Variable="DOTNETHOME_X64"
Result="value"
Root="HKLM"
Key="SOFTWARE\dotnet\Setup\InstalledVersions\x64"
Value="InstallLocation" />
<!-- Check default location when on x64 OS-->
<util:FileSearch Id="DotnetExeSearch_x64"
After="DotnetInstallLocation_x64"
Variable="DotnetExeExists_x64"
Condition="NOT DotnetInstallLocationExists_x64 AND (NOT NativeMachine OR NativeMachine=&quot;$(var.NativeMachine_x64)&quot;)"
Result="exists"
Path="[ProgramFiles64Folder]dotnet\dotnet.exe"/>
<util:DirectorySearch Id="DotnetExeLocation_x64"
After="DotnetExeSearch_x64"
Condition="DotnetExeExists_x64"
Variable="DOTNETHOME_X64"
Path="[ProgramFiles64Folder]dotnet"/>
<!-- Check alternate location on non-x64 OS -->
<util:FileSearch Id="DotnetExeSearch_alt_x64"
After="DotnetInstallLocation_x64"
Variable="DotnetExeExists_alt_x64"
Condition="NOT DotnetInstallLocationExists_x64 AND NOT NativeMachine=&quot;$(var.NativeMachine_x64)&quot;"
Result="exists"
Path="[ProgramFiles64Folder]dotnet\x64\dotnet.exe"/>
<util:DirectorySearch Id="DotnetExeLocation_alt_x64"
After="DotnetExeSearch_alt_x64"
Condition="DotnetExeExists_alt_x64"
Variable="DOTNETHOME_X64"
Path="[ProgramFiles64Folder]dotnet\x64"/>
<?endif?>
<?if $(var.Platform)=arm64?>
<util:RegistrySearch Id="CheckDotnetInstallLocation_arm64"
Variable="DotnetInstallLocationExists_arm64"
Result="exists"
Root="HKLM"
Key="SOFTWARE\dotnet\Setup\InstalledVersions\arm64"
Value="InstallLocation" />
<util:RegistrySearch Id="DotnetInstallLocation_arm64"
After="CheckDotnetInstallLocation_arm64"
Condition="DotnetInstallLocationExists_arm64"
Variable="DOTNETHOME_ARM64"
Result="value"
Root="HKLM"
Key="SOFTWARE\dotnet\Setup\InstalledVersions\arm64"
Value="InstallLocation" />
<util:FileSearch Id="DotnetExeSearch_arm64"
After="DotnetInstallLocation_arm64"
Variable="DotnetExeExists_arm64"
Condition="NOT DotnetInstallLocationExists_arm64"
Result="exists"
Path="[ProgramFiles64Folder]dotnet\dotnet.exe"/>
<util:DirectorySearch Id="DotnetExeLocation_arm64"
After="DotnetExeSearch_arm64"
Condition="DotnetExeExists_arm64"
Variable="DOTNETHOME_ARM64"
Path="[ProgramFiles64Folder]dotnet"/>
<?endif?>
<!--
When installing the SDK bundle to a custom location using the commandline parameters, it is intended, not mandatory, that
both "DOTNETHOME_X86" and "DOTNETHOME_X64" should be used on the commandline and should take this convention:
DOTNETHOME_X86=<InstallFolder>\x86
DOTNETHOME_X64=<InstallFolder>\x64
Example:
dotnet-sdk-3.0.100-alpha1-009719-win-x64.exe /install DOTNETHOME_X64="D:\dotnet\x64" DOTNETHOME_X86="D:\dotnet\x86" /log "installation.log" /quiet /norestart
-->
<Variable Name="DOTNETHOME_X86" bal:Overridable="yes" />
<Variable Name="DOTNETHOME_X64" bal:Overridable="yes" />
<Variable Name="DOTNETHOME_ARM64" bal:Overridable="yes" />
<Variable Name="DOTNETHOME" Type="string" Value="[DOTNETHOME_$(var.PlatformToken)]" bal:Overridable="no" />
<Variable Name="BUNDLEMONIKER" Type="string" Value="$(var.ProductMoniker)" bal:Overridable="no" />
<Variable Name="DOTNETSDKVERSION" Type="string" Value="$(var.NugetVersion)" bal:Overridable="no" />
<Variable Name="DOTNETRUNTIMEVERSION" Type="string" Value="$(var.DotNetRuntimeVersion)" bal:Overridable="no" />
<Variable Name="ASPNETCOREVERSION" Type="string" Value="$(var.AspNetCoreVersion)" bal:Overridable="no" />
<Variable Name="WINFORMSANDWPFVERSION" Type="string" Value="$(var.WinFormsAndWpfVersion)" bal:Overridable="no" />
<Variable Name="DOTNETHOMESIMILARITYCHECKOVERRIDE" Type="string" Value="" bal:Overridable="yes" />
<Variable Name="VERSIONMAJOR" Type="string" Value="$(var.VersionMajor)" bal:Overridable="no" />
<Variable Name="VERSIONMINOR" Type="string" Value="$(var.VersionMinor)" bal:Overridable="no" />
<Variable Name="MINIMUMVSVERSION" Type="string" Value="$(var.MinimumVSVersion)" bal:Overridable="no" />
<Chain DisableSystemRestore="yes" ParallelCache="yes">
<!--
The finalizer is not an actual installation package. We "detect" the EXE
based on the action the bundle is performing to ensure that it runs the uninstall
command only when the bundle is being removed. The package is always installable because the bundle
will remove the package (execute its UninstallCommand) if it is not installable when then bundle is
being installed.
The finalizer is first in the chain to ensure it executes last during an uninstall. When the
SDK is upgraded, the old SDK will be removed before the finalizer executes. This ensures that the
finalizer detects the new SDK and does nothing because the feature band matches.
For an install+uninstall scenario, because the SDK MSI is removed prior to the finalizer, it will
detect that there are no matching feature bands and then clean up workloads associated with
the feature band.
-->
<ExePackage SourceFile="$(var.FinalizerExeSourcePath)"
Cache="always"
DetectCondition="WixBundleAction >= 3"
Id="Finalizer"
InstallCondition="WixBundleAction >= 4"
UninstallCommand="&quot;[WixBundleLog_Finalizer]&quot; $(var.NugetVersion) $(var.Platform)"
Vital="no" />
<MsiPackage SourceFile="$(var.SharedFXMsiSourcePath)">
<MsiProperty Name="DOTNETHOME" Value="[DOTNETHOME]" />
</MsiPackage>
<MsiPackage SourceFile="$(var.HostFXRMsiSourcePath)">
<MsiProperty Name="DOTNETHOME" Value="[DOTNETHOME]" />
</MsiPackage>
<MsiPackage SourceFile="$(var.SharedHostMsiSourcePath)">
<MsiProperty Name="DOTNETHOME" Value="[DOTNETHOME]" />
</MsiPackage>
<MsiPackage SourceFile="$(var.NetCoreAppTargetingPackMsiSourcePath)">
<MsiProperty Name="DOTNETHOME" Value="[DOTNETHOME]" />
</MsiPackage>
<MsiPackage SourceFile="$(var.NetCoreAppHostPackMsiSourcePath)">
<MsiProperty Name="DOTNETHOME" Value="[DOTNETHOME]" />
</MsiPackage>
<?if $(var.Platform)=x86 or $(var.Platform)=x64?>
<MsiPackage SourceFile="$(var.AlternateNetCoreAppHostPackMsiSourcePath)">
<MsiProperty Name="DOTNETHOME" Value="[DOTNETHOME]" />
</MsiPackage>
<MsiPackage SourceFile="$(var.Arm64NetCoreAppHostPackMsiSourcePath)">
<MsiProperty Name="DOTNETHOME" Value="[DOTNETHOME]" />
</MsiPackage>
<MsiPackage SourceFile="$(var.NetStandardTargetingPackMsiSourcePath)">
<MsiProperty Name="DOTNETHOME" Value="[DOTNETHOME]" />
</MsiPackage>
<?endif?>
<MsiPackage SourceFile="$(var.WinFormsAndWpfMsiSourcePath)">
<MsiProperty Name="DOTNETHOME" Value="[DOTNETHOME]" />
</MsiPackage>
<MsiPackage SourceFile="$(var.WindowsDesktopTargetingPackMsiSourcePath)">
<MsiProperty Name="DOTNETHOME" Value="[DOTNETHOME]" />
</MsiPackage>
<MsiPackage SourceFile="$(var.AspNetTargetingPackMsiSourcePath)">
<MsiProperty Name="DOTNETHOME" Value="[DOTNETHOME]" />
</MsiPackage>
<MsiPackage SourceFile="$(var.TemplatesMsiSourcePath)">
<MsiProperty Name="DOTNETHOME" Value="[DOTNETHOME]" />
<MsiProperty Name="ALLOWMSIINSTALL" Value="True" />
</MsiPackage>
<PackageGroupRef Id="PG_WorkloadManifests" />
<MsiPackage SourceFile="$(var.CLISDKMsiSourcePath)">
<MsiProperty Name="DOTNETHOME" Value="[DOTNETHOME]" />
<MsiProperty Name="EXEFULLPATH" Value="[WixBundleOriginalSource]" />
<MsiProperty Name="ALLOWMSIINSTALL" Value="True" />
</MsiPackage>
<?if $(var.Platform)=x86?>
<PackageGroupRef Id="PG_AspNetCoreSharedFramework_x86"/>
<?elseif $(var.Platform)=x64?>
<PackageGroupRef Id="PG_AspNetCoreSharedFramework_x64"/>
<?elseif $(var.Platform)=arm64?>
<PackageGroupRef Id="PG_AspNetCoreSharedFramework_arm64"/>
<?endif?>
</Chain>
</Bundle>
<Fragment>
<PayloadGroup Id="DotnetCoreBAPayloads">
<Payload Name="thm.xml" Compressed="yes" SourceFile="bundle.thm" />
<!-- Default/Neutral localized content is US English -->
<Payload Name="thm.wxl" Compressed="yes" SourceFile="LCID\1033\bundle.wxl" />
<Payload Name="bg.png" Compressed="yes" SourceFile="..\..\osx\clisdk\resources\dotnetbackground.png" />
<?foreach LCID in $(var.LocalizedContentDirs)?>
<Payload Id="thm-$(var.LCID)" Compressed="yes" Name="$(var.LCID)\thm.wxl" SourceFile="LCID\$(var.LCID)\bundle.wxl" />
<?endforeach?>
<Payload Name='eula.rtf' Compressed='yes' SourceFile='!(wix.WixStdbaLicenseRtf)' />
</PayloadGroup>
<CustomTable Id='WixStdbaInformation'>
<Row>
<Data Column='LicenseFile'>eula.rtf</Data>
</Row>
</CustomTable>
</Fragment>
</Wix>