PowerToys/installer/PowerToysSetup/PowerToys.wxs
2022-11-29 12:51:52 +00:00

119 lines
6.7 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<?define UpgradeCode="6341382d-c0a9-4238-9188-be9607e3fab2"?>
<?define RepoDir="$(var.ProjectDir)..\..\" ?>
<?if $(var.Platform) = x64?>
<?define BinDir="$(var.RepoDir)$(var.Platform)\$(var.Configuration)\" ?>
<?define PowerToysPlatform="x64"?>
<?define Dotnet6DownloadUrl="https://download.visualstudio.microsoft.com/download/pr/0192a249-3ec8-4374-a827-e186dd58d55d/cec046575f3eb2247a10ba3d50f5cf6c/windowsdesktop-runtime-6.0.11-win-x64.exe"?>
<?define Dotnet6PayloadSize="57217584"?>
<?define Dotnet6PayloadHash="B9E3AB8E3048170D9E3EABF6761D423EB4C93C6D"?>
<?define PlatformProgramFiles="[ProgramFiles64Folder]"?>
<?else?>
<!-- stable WIX 3 doesn't support ARM64, so we build installers as x86 -->
<?define BinDir="$(var.RepoDir)ARM64\$(var.Configuration)\" ?>
<?define PowerToysPlatform="ARM64"?>
<?define Dotnet6DownloadUrl="https://download.visualstudio.microsoft.com/download/pr/70d9846e-7bae-496c-829d-dabfda93cddd/be9e28ef860bfc7f8f36db4af4ac7692/windowsdesktop-runtime-6.0.11-win-arm64.exe"?>
<?define Dotnet6PayloadSize="51124616"?>
<?define Dotnet6PayloadHash="5222A0F11071EB0806A9745A82F820E8B950BCE3"?>
<!--TODO: define to ARM64 Program files once it's available-->
<?define PlatformProgramFiles="[ProgramFiles6432Folder]"?>
<?endif?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Bundle Name="PowerToys (Preview) $(var.PowerToysPlatform)"
Version="$(var.Version)"
Manufacturer="Microsoft Corporation"
IconSourceFile="$(var.BinDir)svgs\icon.ico"
UpgradeCode="$(var.UpgradeCode)">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication
LicenseFile="$(var.RepoDir)\installer\License.rtf"
LogoFile="$(var.RepoDir)\installer\PowerToysSetup\Images\logo44.png"
SuppressOptionsUI="no"
SuppressRepair="yes" />
</BootstrapperApplicationRef>
<util:FileSearch Variable="HasDotnet6011" Path="$(var.PlatformProgramFiles)dotnet\shared\Microsoft.WindowsDesktop.App\6.0.11\System.Xaml.dll" Result="exists" />
<util:RegistrySearch Variable="HasWebView2PerMachine" Root="HKLM" Key="SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" Result="exists" />
<util:RegistrySearch Variable="HasWebView2PerUser" Root="HKCU" Key="Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" Result="exists" />
<Variable Name="InstallFolder" Type="string" Value="$(var.PlatformProgramFiles)PowerToys" bal:Overridable="yes"/>
<Variable Name="MsiLogFolder" Type="string" Value="[LocalAppDataFolder]\Microsoft\PowerToys\" />
<Log Disable="no" Prefix='powertoys-bootstrapper-msi-$(var.Version)' Extension=".log" />
<!-- Only install/upgrade if the version is greater or equal than the currently installed version of PowerToys, to handle the case in which PowerToys was installed from old MSI (before WiX bootstrapper was used) -->
<!-- If the previous installation is a bundle installation, just let WiX run its logic. -->
<Variable Name="DetectedPowerToysVersion" Type="version" Value="0.0.0.0"/>
<Variable Name="TargetPowerToysVersion" Type="version" Value="$(var.Version)"/>
<util:ProductSearch Id="SearchInstalledPowerToysVersion" Variable="DetectedPowerToysVersion" UpgradeCode="42B84BF7-5FBF-473B-9C8B-049DC16F7708" Result="version" />
<bal:Condition Message="A later version of PowerToys is already installed." >TargetPowerToysVersion &gt;= DetectedPowerToysVersion OR WixBundleInstalled</bal:Condition>
<Variable Name="DetectedWindowsBuildNumber" Type="version" Value="0"/>
<util:RegistrySearch Id="SearchWindowsBuildNumber" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion" Value="CurrentBuildNumber" Result="value" Format="raw" Variable="DetectedWindowsBuildNumber" />
<bal:Condition Message="This application is only supported on Windows 10 version v2004 (build 19041) or higher.">DetectedWindowsBuildNumber &gt;= 19041 OR WixBundleInstalled</bal:Condition>
<Chain>
<ExePackage
DisplayName="Closing PowerToys application"
Name="terminate_powertoys.cmd"
Cache="no"
Compressed="yes"
Id="TerminatePowerToys"
SourceFile="terminate_powertoys.cmd"
Permanent="yes"
PerMachine="yes"
Vital="no">
</ExePackage>
<ExePackage
DisplayName="Downloading and installing .NET 6 Desktop Runtime"
Name="windowsdesktop-runtime-6.0.11-win-$(var.PowerToysPlatform).exe"
Compressed="no"
Id="DotnetRuntime6"
DetectCondition="HasDotnet6011"
DownloadUrl="$(var.Dotnet6DownloadUrl)"
InstallCommand="/install /quiet /norestart"
RepairCommand="/repair /passive /norestart"
Permanent="yes"
PerMachine="yes"
UninstallCommand="/uninstall /quiet /norestart">
<ExitCode Value="1638" Behavior="success"/>
<RemotePayload
Description="Microsoft Windows Desktop Runtime - 6.0.11 ($(var.PowerToysPlatform))"
ProductName="Microsoft Windows Desktop Runtime - 6.0.11 ($(var.PowerToysPlatform))"
Size="$(var.Dotnet6PayloadSize)"
Version="6.0.11.31823"
Hash="$(var.Dotnet6PayloadHash)" />
</ExePackage>
<ExePackage
DisplayName="Installing Microsoft Edge WebView2"
Name="MicrosoftEdgeWebview2Setup.exe"
Compressed="yes"
Id="WebView2"
DetectCondition="HasWebView2PerMachine OR HasWebView2PerUser"
SourceFile="WebView2\MicrosoftEdgeWebview2Setup.exe"
InstallCommand="/silent /install"
RepairCommand="/repair /passive"
Permanent="yes"
PerMachine="yes"
UninstallCommand="/silent /uninstall">
</ExePackage>
<MsiPackage
DisplayName="Installing PowerToys"
SourceFile="$(var.PowerToysPlatform)\Release\PowerToysSetup-$(var.Version)-$(var.PowerToysPlatform).msi"
Compressed="yes"
DisplayInternalUI="no">
<MsiProperty Name="BOOTSTRAPPERINSTALLFOLDER" Value="[InstallFolder]" />
</MsiPackage>
</Chain>
</Bundle>
</Wix>