From 69108ceeabe93706622eeacb64caafa2c231a77b Mon Sep 17 00:00:00 2001 From: John Luo <johluo@microsoft.com> Date: Wed, 3 Mar 2021 10:06:36 -0800 Subject: [PATCH] Enable ARM64 installers build. (#25579) (#30463) * Enable ARM64 installers build. (#25579) Changes WiX toolset used to 3.14 to support ARM64 Generates targeting pack from the x86/x64 leg, as it gets produced using a zip that gets generated there. The ARM64 leg now produces all the necessary msi's, exe, and wixlib needed for the installer to generate a bundle. * Build tageting pack installers * Set TP version to 3.1.10 --- .azure/pipelines/ci.yml | 55 ++++++++++++++----- Directory.Build.props | 3 +- Directory.Build.targets | 3 +- eng/Build.props | 17 +++++- eng/Versions.props | 2 +- .../Windows/SharedFramework/Product.wxs | 4 +- .../SharedFramework/SharedFramework.wixproj | 4 ++ .../Windows/SharedFrameworkBundle/Bundle.wxs | 2 + .../SharedFrameworkBundle.wixproj | 43 ++++++++++----- .../Windows/SharedFrameworkLib/Library.wxs | 3 + .../Windows/TargetingPack/Product.wxs | 4 +- .../TargetingPack/TargetingPack.wixproj | 4 +- src/Installers/Windows/Wix.targets | 8 ++- 13 files changed, 115 insertions(+), 37 deletions(-) diff --git a/.azure/pipelines/ci.yml b/.azure/pipelines/ci.yml index cadffb60647..775a7633991 100644 --- a/.azure/pipelines/ci.yml +++ b/.azure/pipelines/ci.yml @@ -255,21 +255,39 @@ stages: jobName: Windows_64_build jobDisplayName: "Build: Windows ARM64" agentOs: Windows - buildArgs: - -arch arm64 - -sign - -pack - -noBuildNodeJS - -noBuildJava - /bl:artifacts/log/build.win-arm64.binlog - /p:DotNetSignType=$(_SignType) - /p:OnlyPackPlatformSpecificPackages=true - /p:AssetManifestFileName=aspnetcore-win-arm64.xml - $(_BuildArgs) - $(_PublishArgs) - $(_InternalRuntimeDownloadArgs) installNodeJs: false installJdk: false + steps: + - script: ./build.cmd + -ci + -arch arm64 + -sign + -pack + -noBuildJava + -noBuildNative + /p:DotNetSignType=$(_SignType) + /p:OnlyPackPlatformSpecificPackages=true + $(_BuildArgs) + $(_InternalRuntimeDownloadArgs) + /bl:artifacts/log/Release/Build.arm64.binlog + displayName: Build ARM64 + + # Windows installers bundle for arm64 + - script: ./build.cmd + -ci + -noBuildRepoTasks + -arch arm64 + -sign + -buildInstallers + -noBuildNative + /p:DotNetSignType=$(_SignType) + /p:AssetManifestFileName=aspnetcore-win-arm64.xml + $(_BuildArgs) + $(_PublishArgs) + $(_InternalRuntimeDownloadArgs) + /bl:artifacts/log/Release/Build.Installers.Arm64.binlog + displayName: Build Arm64 Installers + artifacts: - name: Windows_arm64_Logs path: artifacts/log/ @@ -280,6 +298,17 @@ stages: - name: Windows_arm64_Installers path: artifacts/installers/ + # A few files must also go to the VS package feed. + - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: NuGetCommand@2 + displayName: Push Visual Studio packages + inputs: + command: push + packagesToPush: 'artifacts/packages/**/VS.Redist.Common.AspNetCore.*.nupkg' + nuGetFeedType: external + publishFeedCredentials: 'DevDiv - VS package feed' + + # Build MacOS - template: jobs/default-build.yml parameters: diff --git a/Directory.Build.props b/Directory.Build.props index e2802509629..7d0e04d1625 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -84,7 +84,8 @@ <RuntimeInstallerBaseName>aspnetcore-runtime</RuntimeInstallerBaseName> <TargetingPackInstallerBaseName>aspnetcore-targeting-pack</TargetingPackInstallerBaseName> - <!-- Produce targeting pack installers/packages once per major.minor except in extraordinary cases i.e. 3.1.10. --> + <!-- Produce targeting pack installers/packages once per major.minor except in extraordinary cases i.e. 3.1.14 win-arm64. --> + <IsTargetingPackBuilding Condition=" '$(AspNetCorePatchVersion)' == '14' AND '$(TargetArchitecture)' == 'arm64' AND $([MSBuild]::IsOSPlatform('Windows')) ">true</IsTargetingPackBuilding> <IsTargetingPackBuilding Condition=" '$(DotNetBuildFromSource)' == 'true' ">false</IsTargetingPackBuilding> <IsTargetingPackBuilding Condition=" '$(IsTargetingPackBuilding)' == '' AND '$(AspNetCorePatchVersion)' != '10' ">false</IsTargetingPackBuilding> diff --git a/Directory.Build.targets b/Directory.Build.targets index ade53fc51d6..417057a3090 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -57,7 +57,8 @@ <PropertyGroup> <!-- When OnlyPackPlatformSpecificPackages is set, only produce packages for projects which set RuntimeIdentifier. --> <!-- Keep this below where we set "IsPackageInThisPatch" --> - <IsPackable Condition=" '$(OnlyPackPlatformSpecificPackages)' == 'true' AND '$(RuntimeIdentifier)' == '' ">false</IsPackable> + <!-- Do not apply this logic to App.Ref and App.Ref.Internal, it's packability is determined by IsTargetingPackBuilding --> + <IsPackable Condition=" '$(MSBuildProjectName)' != 'Microsoft.AspNetCore.App.Ref' AND '$(MSBuildProjectName)' != 'Microsoft.AspNetCore.App.Ref.Internal' AND '$(OnlyPackPlatformSpecificPackages)' == 'true' AND '$(RuntimeIdentifier)' == '' ">false</IsPackable> </PropertyGroup> <PropertyGroup> diff --git a/eng/Build.props b/eng/Build.props index 576ca818a79..2f86a7090c6 100644 --- a/eng/Build.props +++ b/eng/Build.props @@ -60,7 +60,7 @@ </ItemGroup> </When> <Otherwise> - <ItemGroup Condition=" '$(BuildInstallers)' == 'true' AND '$(TargetOsName)' == 'win' "> + <ItemGroup Condition=" '$(BuildInstallers)' == 'true' AND '$(TargetOsName)' == 'win' AND ('$(TargetArchitecture)' == 'x86' OR '$(TargetArchitecture)' == 'x64') "> <!-- Build the ANCM custom action --> <ProjectToBuild Include="$(RepoRoot)src\Installers\Windows\AspNetCoreModule-Setup\CustomAction\aspnetcoreCA.vcxproj" AdditionalProperties="Platform=x64" /> <ProjectToBuild Include="$(RepoRoot)src\Installers\Windows\AspNetCoreModule-Setup\CustomAction\aspnetcoreCA.vcxproj" AdditionalProperties="Platform=Win32" /> @@ -74,6 +74,10 @@ <!-- Build the targeting pack installers --> <ProjectToBuild Include="$(RepoRoot)src\Installers\Windows\TargetingPack\TargetingPack.wixproj" AdditionalProperties="Platform=x64" /> <ProjectToBuild Include="$(RepoRoot)src\Installers\Windows\TargetingPack\TargetingPack.wixproj" AdditionalProperties="Platform=x86" /> + <!-- This really shouldn't be here, but instead of harvesting from the intermediate/output directories, the targetting pack installer logic + harvests from a zip of the reference assemblies. Producing it in each leg ends up with multiple targeting packs + getting produced and the BAR will reject the build. Centralize building the targeting pack in the x86/x64 leg. --> + <ProjectToBuild Include="$(RepoRoot)src\Installers\Windows\TargetingPack\TargetingPack.wixproj" AdditionalProperties="Platform=arm64" /> <!-- Build the SharedFramework installers --> <ProjectToBuild Include="$(RepoRoot)src\Installers\Windows\SharedFrameworkBundle\SharedFrameworkBundle.wixproj" AdditionalProperties="Platform=x64" /> @@ -87,6 +91,17 @@ <ProjectToBuild Include="$(RepoRoot)src\Installers\Windows\WindowsHostingBundle\WindowsHostingBundle.wixproj" AdditionalProperties="Platform=x86" /> </ItemGroup> + <ItemGroup Condition=" '$(BuildInstallers)' == 'true' AND '$(TargetOsName)' == 'win' AND '$(TargetArchitecture)' == 'arm64' "> + <!-- We don't build the bundle here because we'd have to bundle the x86 installer which gets built in a different leg. + Instead we only provide the ARM64 MSI--> + + <!-- Build the targeting pack installers --> + <ProjectToBuild Include="$(RepoRoot)src\Installers\Windows\TargetingPack\TargetingPack.wixproj" AdditionalProperties="Platform=arm64" /> + + <!-- Build the SharedFramework wixlib --> + <ProjectToBuild Include="$(RepoRoot)src\Installers\Windows\SharedFrameworkLib\SharedFrameworkLib.wixproj" AdditionalProperties="Platform=arm64" /> + </ItemGroup> + <ItemGroup Condition="'$(BuildInstallers)' == 'true' AND '$(TargetRuntimeIdentifier)' == 'linux-x64'"> <ProjectToBuild Condition=" '$(LinuxInstallerType)' == 'deb' " Include="$(RepoRoot)src\Installers\Debian\**\*.*proj" /> diff --git a/eng/Versions.props b/eng/Versions.props index 99d20fb2aa7..b24cf893501 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -10,7 +10,7 @@ <AspNetCoreMinorVersion>1</AspNetCoreMinorVersion> <AspNetCorePatchVersion>14</AspNetCorePatchVersion> <ValidateBasline>false</ValidateBasline> - + <PreReleasePreviewNumber>0</PreReleasePreviewNumber> <ComponentsWebAssemblyMajorVersion>3</ComponentsWebAssemblyMajorVersion> <ComponentsWebAssemblyMinorVersion>2</ComponentsWebAssemblyMinorVersion> diff --git a/src/Installers/Windows/SharedFramework/Product.wxs b/src/Installers/Windows/SharedFramework/Product.wxs index 2a71da323a2..3375094918c 100644 --- a/src/Installers/Windows/SharedFramework/Product.wxs +++ b/src/Installers/Windows/SharedFramework/Product.wxs @@ -2,7 +2,7 @@ <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Product Id="$(var.ProductCode)" Name="$(var.ProductName)" Language="1033" Version="$(var.Version)" Manufacturer="Microsoft Corporation" UpgradeCode="$(var.UpgradeCode)"> - <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> + <Package InstallerVersion="$(var.InstallerVersion)" Compressed="yes" InstallScope="perMachine" /> <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." Schedule="afterInstallFinalize" /> <Media Id="1" Cabinet="$(var.Cabinet)" CompressionLevel="high" EmbedCab="$(var.EmbedCab)" /> @@ -21,7 +21,7 @@ <?if $(var.Platform)=x86?> <?define PFilesFolder=ProgramFilesFolder?> - <?elseif $(var.Platform)=x64?> + <?elseif $(var.Platform)=x64 or $(var.Platform)=arm64?> <?define PFilesFolder=ProgramFiles64Folder?> <?else?> <?error Invalid Platform ($(var.Platform))?> diff --git a/src/Installers/Windows/SharedFramework/SharedFramework.wixproj b/src/Installers/Windows/SharedFramework/SharedFramework.wixproj index 1b64c2cbb83..1574f5794ff 100644 --- a/src/Installers/Windows/SharedFramework/SharedFramework.wixproj +++ b/src/Installers/Windows/SharedFramework/SharedFramework.wixproj @@ -61,12 +61,16 @@ <!-- TODO: https://github.com/aspnet/AspNetCore/issues/6304. Harvest shared frameworks from a project reference --> <Target Name="ExtractIntermediateSharedFx" BeforeTargets="PrepareForBuild"> <PropertyGroup> + <SharedFrameworkArm64HarvestRootPath Condition="'$(SharedFrameworkArm64HarvestRootPath)' == ''">$(InstallersOutputPath)</SharedFrameworkArm64HarvestRootPath> <SharedFrameworkX64HarvestRootPath Condition="'$(SharedFrameworkX64HarvestRootPath)' == ''">$(InstallersOutputPath)</SharedFrameworkX64HarvestRootPath> <SharedFrameworkX86HarvestRootPath Condition="'$(SharedFrameworkX86HarvestRootPath)' == ''">$(InstallersOutputPath)</SharedFrameworkX86HarvestRootPath> + <IntermediateArm64SharedFxZip>$(SharedFrameworkArm64HarvestRootPath)aspnetcore-runtime-internal-$(PackageVersion)-win-arm64.zip</IntermediateArm64SharedFxZip> <IntermediateX64SharedFxZip>$(SharedFrameworkX64HarvestRootPath)aspnetcore-runtime-internal-$(PackageVersion)-win-x64.zip</IntermediateX64SharedFxZip> <IntermediateX86SharedFxZip>$(SharedFrameworkX86HarvestRootPath)aspnetcore-runtime-internal-$(PackageVersion)-win-x86.zip</IntermediateX86SharedFxZip> </PropertyGroup> + <Unzip Condition="'$(Platform)' == 'arm64'" + SourceFiles="$(IntermediateArm64SharedFxZip)" DestinationFolder="$(HarvestSource)" /> <Unzip Condition="'$(Platform)' == 'x64'" SourceFiles="$(IntermediateX64SharedFxZip)" DestinationFolder="$(HarvestSource)" /> <Unzip Condition="'$(Platform)' == 'x86'" diff --git a/src/Installers/Windows/SharedFrameworkBundle/Bundle.wxs b/src/Installers/Windows/SharedFrameworkBundle/Bundle.wxs index 48115ca2197..580187b09e7 100644 --- a/src/Installers/Windows/SharedFrameworkBundle/Bundle.wxs +++ b/src/Installers/Windows/SharedFrameworkBundle/Bundle.wxs @@ -93,6 +93,8 @@ <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> diff --git a/src/Installers/Windows/SharedFrameworkBundle/SharedFrameworkBundle.wixproj b/src/Installers/Windows/SharedFrameworkBundle/SharedFrameworkBundle.wixproj index 7aa16e58ec0..f9f285c8739 100644 --- a/src/Installers/Windows/SharedFrameworkBundle/SharedFrameworkBundle.wixproj +++ b/src/Installers/Windows/SharedFrameworkBundle/SharedFrameworkBundle.wixproj @@ -29,20 +29,35 @@ <Content Include="thm.xml" /> </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\SharedFrameworkLib\SharedFrameworkLib.wixproj" SetPlatform="Platform=x86"> - <Name>SharedFrameworkLib</Name> - <Project>{5244BC49-2568-4701-80A6-EAB8950AB5FA}</Project> - <Private>True</Private> - <DoNotHarvest>True</DoNotHarvest> - </ProjectReference> - <ProjectReference Include="..\SharedFrameworkLib\SharedFrameworkLib.wixproj" SetPlatform="Platform=x64"> - <Name>SharedFrameworkLib</Name> - <Project>{5244BC49-2568-4701-80A6-EAB8950AB5FA}</Project> - <Private>True</Private> - <DoNotHarvest>True</DoNotHarvest> - </ProjectReference> - </ItemGroup> + <Choose> + <When Condition="'$(Platform)' == 'arm64'"> + <ItemGroup> + <ProjectReference Include="..\SharedFrameworkLib\SharedFrameworkLib.wixproj" SetPlatform="Platform=arm64"> + <Name>SharedFrameworkLib</Name> + <Project>{5244BC49-2568-4701-80A6-EAB8950AB5FA}</Project> + <Private>True</Private> + <DoNotHarvest>True</DoNotHarvest> + </ProjectReference> + </ItemGroup> + </When> + <Otherwise> + <ItemGroup> + <ProjectReference Include="..\SharedFrameworkLib\SharedFrameworkLib.wixproj" SetPlatform="Platform=x86"> + <Name>SharedFrameworkLib</Name> + <Project>{5244BC49-2568-4701-80A6-EAB8950AB5FA}</Project> + <Private>True</Private> + <DoNotHarvest>True</DoNotHarvest> + </ProjectReference> + <ProjectReference Include="..\SharedFrameworkLib\SharedFrameworkLib.wixproj" SetPlatform="Platform=x64"> + <Name>SharedFrameworkLib</Name> + <Project>{5244BC49-2568-4701-80A6-EAB8950AB5FA}</Project> + <Private>True</Private> + <DoNotHarvest>True</DoNotHarvest> + </ProjectReference> + </ItemGroup> + </Otherwise> + </Choose> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" /> diff --git a/src/Installers/Windows/SharedFrameworkLib/Library.wxs b/src/Installers/Windows/SharedFrameworkLib/Library.wxs index dde16acbd7f..c30f743d0bb 100644 --- a/src/Installers/Windows/SharedFrameworkLib/Library.wxs +++ b/src/Installers/Windows/SharedFrameworkLib/Library.wxs @@ -16,6 +16,9 @@ <?elseif $(var.Platform)=x64?> <?define SharedFrameworkInstallCondition=VersionNT64 AND (NOT OPT_NO_SHAREDFX)?> <?define DotNetHome=DOTNETHOME_X64?> + <?elseif $(var.Platform)=arm64?> + <?define SharedFrameworkInstallCondition=VersionNT64 AND (NOT OPT_NO_SHAREDFX)?> + <?define DotNetHome=DOTNETHOME_ARM64?> <?endif?> <MsiPackage Id="AspNetCoreSharedFramework_$(var.Platform)" diff --git a/src/Installers/Windows/TargetingPack/Product.wxs b/src/Installers/Windows/TargetingPack/Product.wxs index ce7bda6695e..a43f6ab4e17 100644 --- a/src/Installers/Windows/TargetingPack/Product.wxs +++ b/src/Installers/Windows/TargetingPack/Product.wxs @@ -2,7 +2,7 @@ <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Product Id="$(var.ProductCode)" Name="$(var.ProductName)" Language="1033" Version="$(var.Version)" Manufacturer="Microsoft Corporation" UpgradeCode="$(var.UpgradeCode)"> - <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> + <Package InstallerVersion="$(var.InstallerVersion)" Compressed="yes" InstallScope="perMachine" /> <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." Schedule="afterInstallFinalize" /> <Media Id="1" Cabinet="$(var.Cabinet)" CompressionLevel="high" EmbedCab="$(var.EmbedCab)" /> @@ -21,7 +21,7 @@ <?if $(var.Platform)=x86?> <?define PFilesFolder=ProgramFilesFolder?> - <?elseif $(var.Platform)=x64?> + <?elseif $(var.Platform)=x64 or $(var.Platform)=arm64?> <?define PFilesFolder=ProgramFiles64Folder?> <?else?> <?error Invalid Platform ($(var.Platform))?> diff --git a/src/Installers/Windows/TargetingPack/TargetingPack.wixproj b/src/Installers/Windows/TargetingPack/TargetingPack.wixproj index b673cf41523..81e32c53ee4 100644 --- a/src/Installers/Windows/TargetingPack/TargetingPack.wixproj +++ b/src/Installers/Windows/TargetingPack/TargetingPack.wixproj @@ -21,6 +21,8 @@ <NamespaceGuid>DDBB771F-963F-47D3-8510-9ABD04DBE1D1</NamespaceGuid> <SchemaVersion>2.0</SchemaVersion> <ToolsetInstallerNuspecFile>$(RepoRoot)\src\Installers\Windows\TargetingPack\TargetingPackPackage.nuspec</ToolsetInstallerNuspecFile> + <PackageVersion>$(TargetingPackVersionPrefix)</PackageVersion> + <BundleVersion>$(TargetingPackVersionPrefix)</BundleVersion> </PropertyGroup> <ItemGroup> @@ -61,7 +63,7 @@ <Target Name="ExtractIntermediateTargetingPack" BeforeTargets="PrepareForBuild"> <PropertyGroup> <TargetingPackHarvestRoot Condition="'$(TargetingPackHarvestRoot)' == ''">$(InstallersOutputPath)</TargetingPackHarvestRoot> - <IntermediateTargetingPackZip>$(TargetingPackHarvestRoot)aspnetcore-targeting-pack-$(PackageVersion).zip</IntermediateTargetingPackZip> + <IntermediateTargetingPackZip>$(TargetingPackHarvestRoot)aspnetcore-targeting-pack-$(TargetingPackVersionPrefix).zip</IntermediateTargetingPackZip> </PropertyGroup> <Unzip SourceFiles="$(IntermediateTargetingPackZip)" DestinationFolder="$(HarvestSource)" /> diff --git a/src/Installers/Windows/Wix.targets b/src/Installers/Windows/Wix.targets index dacb9e79043..bb079c09eb3 100644 --- a/src/Installers/Windows/Wix.targets +++ b/src/Installers/Windows/Wix.targets @@ -4,10 +4,16 @@ <!-- Actual upgrade code used in bundles to ensure upgrades withing a version band, e.g. 3.0.0.xxx --> <_FileRevisionVersion>$(VersionSuffixDateStamp)</_FileRevisionVersion> <_FileRevisionVersion Condition=" '$(_FileRevisionVersion)' == '' ">42424</_FileRevisionVersion> - <BundleVersion>$(AspNetCoreMajorMinorVersion).$(AspNetCorePatchVersion).$(_FileRevisionVersion)</BundleVersion> + <BundleVersion Condition="'$(BundleVersion)' != ''" >$(BundleVersion).$(_FileRevisionVersion)</BundleVersion> + <BundleVersion Condition="'$(BundleVersion)' == ''" >$(AspNetCoreMajorMinorVersion).$(AspNetCorePatchVersion).$(_FileRevisionVersion)</BundleVersion> <!-- Used for generating stable upgrade codes for bundles --> <Version>$(BundleVersion)</Version> + <!-- ARM64 MSIs require the installer version to be at least 500. --> + <!-- See: https://docs.microsoft.com/en-us/windows/win32/msi/64-bit-windows-installer-packages --> + <DefineConstants Condition=" '$(Platform)' == 'arm64' ">$(DefineConstants);InstallerVersion=500</DefineConstants> + <DefineConstants Condition=" '$(Platform)' != 'arm64' ">$(DefineConstants);InstallerVersion=200</DefineConstants> + <DefineConstants>$(DefineConstants);MajorVersion=$(AspNetCoreMajorVersion)</DefineConstants> <DefineConstants>$(DefineConstants);MinorVersion=$(AspNetCoreMinorVersion)</DefineConstants> <DefineConstants>$(DefineConstants);Version=$(Version)</DefineConstants> -- GitLab