From 082265dd3a159a8c098a0486a7822d91bacf7d2c Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Tue, 2 Nov 2021 23:39:27 -0700 Subject: [PATCH 1/6] Bundle workload manifests as separate MSIs --- src/redist/targets/BundledManifests.targets | 115 ++++++------- src/redist/targets/GenerateMSIs.targets | 66 +++----- .../packaging/windows/clisdk/bundle.wxs | 5 +- .../windows/clisdk/generatebundle.ps1 | 7 +- .../windows/clisdk/generatemanifestsmsi.ps1 | 153 ------------------ 5 files changed, 78 insertions(+), 268 deletions(-) delete mode 100644 src/redist/targets/packaging/windows/clisdk/generatemanifestsmsi.ps1 diff --git a/src/redist/targets/BundledManifests.targets b/src/redist/targets/BundledManifests.targets index db6c2c6e5..ee574e06a 100644 --- a/src/redist/targets/BundledManifests.targets +++ b/src/redist/targets/BundledManifests.targets @@ -1,84 +1,61 @@ - - - - - - - - + + + + + + + + - + + + + + $(Architecture) + - - [%(Version)] - - - - - - - - $(NuGetPackageRoot)$([MSBuild]::ValueOrDefault('%(Identity)', '').ToLower())/$([MSBuild]::ValueOrDefault('%(Version)', '').ToLower()) + + %(Identity).Manifest-%(FeatureBand) + %(Identity).Manifest-%(FeatureBand).Msi.$(MsiArchitectureForWorkloadManifests) + $(NuGetPackageRoot)$([MSBuild]::ValueOrDefault('%(NupkgId)', '').ToLower())/$([MSBuild]::ValueOrDefault('%(Version)', '').ToLower()) + $(NuGetPackageRoot)$([MSBuild]::ValueOrDefault('%(MsiNupkgId)', '').ToLower())/$([MSBuild]::ValueOrDefault('%(Version)', '').ToLower()) + %(RestoredMsiNupkgContentPath)/data/%(NupkgId).%(Version)-$(MsiArchitectureForWorkloadManifests).msi - + + + + [%(Version)] + - + + [%(Version)] + + + + + + + + + + + + - - - - - - - - - - - $(ArtifactsNonShippingPackagesDir)dotnet-sdkmanifests-$(FullNugetVersion)-$(ProductMonikerRid)$(InstallerExtension) - SDK_Manifests_$([MSBuild]::ValueOrDefault('$(Version)', '').Replace('-', '_')) - Microsoft .NET SDK Workload Manifests $(Version) - $(BaseOutputPath)$(Configuration)\sdk-manifests - - - - - - - - - - - - - - - - - - - diff --git a/src/redist/targets/GenerateMSIs.targets b/src/redist/targets/GenerateMSIs.targets index e0e948128..d17a563da 100644 --- a/src/redist/targets/GenerateMSIs.targets +++ b/src/redist/targets/GenerateMSIs.targets @@ -283,49 +283,36 @@ - - + - $(MSBuildThisFileDirectory)packaging/windows/clisdk/generatemanifestsmsi.ps1 + $(IntermediateOutputPath)WorkloadManifests.wxs + + + + + + + @(BundledManifests->' + + + ', ' + ') + + + +]]> + - - - - - - - - - - - + - - - - + diff --git a/src/redist/targets/packaging/windows/clisdk/generatebundle.ps1 b/src/redist/targets/packaging/windows/clisdk/generatebundle.ps1 index d68bf8441..4cf3d5697 100644 --- a/src/redist/targets/packaging/windows/clisdk/generatebundle.ps1 +++ b/src/redist/targets/packaging/windows/clisdk/generatebundle.ps1 @@ -2,6 +2,7 @@ # Licensed under the MIT license. See LICENSE file in the project root for full license information. param( + [Parameter(Mandatory=$true)][string]$WorkloadManifestWxsFile, [Parameter(Mandatory=$true)][string]$CLISDKMSIFile, [Parameter(Mandatory=$true)][string]$ASPNETRuntimeWixLibFile, [Parameter(Mandatory=$true)][string]$SharedFxMSIFile, @@ -18,7 +19,6 @@ param( [Parameter(Mandatory=$true)][string]$WindowsDesktopTargetingPackMSIFile, [Parameter(Mandatory=$true)][string]$FinalizerExe, [Parameter(Mandatory=$true)][string]$TemplatesMSIFile, - [Parameter(Mandatory=$true)][string]$ManifestsMSIFile, [Parameter(Mandatory=$true)][string]$DotnetBundleOutput, [Parameter(Mandatory=$true)][string]$WixRoot, [Parameter(Mandatory=$true)][string]$ProductMoniker, @@ -78,7 +78,7 @@ function RunCandleForBundle -ext WixBalExtension.dll ` -ext WixUtilExtension.dll ` -ext WixTagExtension.dll ` - "$AuthWsxRoot\bundle.wxs" + "$AuthWsxRoot\bundle.wxs" "$WorkloadManifestWxsFile" Write-Information "Candle output: $candleOutput" @@ -97,11 +97,14 @@ function RunLightForBundle $result = $true pushd "$WixRoot" + $WorkloadManifestWixobjFile = [System.IO.Path]::GetFileNameWithoutExtension($WorkloadManifestWxsFile) + ".wixobj" + Write-Information "Running light for bundle.." $lightOutput = .\light.exe -nologo ` -cultures:en-us ` bundle.wixobj ` + $WorkloadManifestWixobjFile ` $ASPNETRuntimeWixlibFile ` -ext WixBalExtension.dll ` -ext WixUtilExtension.dll ` diff --git a/src/redist/targets/packaging/windows/clisdk/generatemanifestsmsi.ps1 b/src/redist/targets/packaging/windows/clisdk/generatemanifestsmsi.ps1 deleted file mode 100644 index bef841dc2..000000000 --- a/src/redist/targets/packaging/windows/clisdk/generatemanifestsmsi.ps1 +++ /dev/null @@ -1,153 +0,0 @@ -# Copyright (c) .NET Foundation and contributors. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. - -param( - [Parameter(Mandatory=$true)][string]$inputDir, - [Parameter(Mandatory=$true)][string]$DotnetMSIOutput, - [Parameter(Mandatory=$true)][string]$WixRoot, - [Parameter(Mandatory=$true)][string]$ProductMoniker, - [Parameter(Mandatory=$true)][string]$DotnetMSIVersion, - [Parameter(Mandatory=$true)][string]$SDKBundleVersion, - [Parameter(Mandatory=$true)][string]$DotnetCLINugetVersion, - [Parameter(Mandatory=$true)][string]$UpgradeCode, - [Parameter(Mandatory=$true)][string]$DependencyKeyName, - [Parameter(Mandatory=$true)][string]$Architecture -) - -$InstallFileswsx = ".\manifest-install-files.wxs" -$InstallFilesWixobj = "manifest-install-files.wixobj" - -function RunHeat -{ - $result = $true - pushd "$WixRoot" - - Write-Information "Running heat.." - - $heatOutput = .\heat.exe dir `"$inputDir`" -template fragment ` - -sreg -ag ` - -var var.DotnetSrc ` - -cg InstallFiles ` - -srd ` - -dr DOTNETHOME ` - -out manifest-install-files.wxs - - Write-Information "Heat output: $heatOutput" - - if($LastExitCode -ne 0) - { - $result = $false - Write-Information "Heat failed with exit code $LastExitCode." - } - - popd - Write-Information "RunHeat result: $result" - return $result -} - -function RunCandle -{ - $result = $true - pushd "$WixRoot" - - Write-Information "Running candle.." - - $candleOutput = .\candle.exe -nologo ` - -dDotnetSrc="$inputDir" ` - -dMicrosoftEula="$PSScriptRoot\dummyeula.rtf" ` - -dProductMoniker="$ProductMoniker" ` - -dBuildVersion="$DotnetMSIVersion" ` - -dSDKBundleVersion="$SDKBundleVersion" ` - -dNugetVersion="$DotnetCLINugetVersion" ` - -dUpgradeCode="$UpgradeCode" ` - -dDependencyKeyName="$DependencyKeyName" ` - -arch "$Architecture" ` - -ext WixDependencyExtension.dll ` - "$PSScriptRoot\manifests.wxs" ` - "$PSScriptRoot\provider.wxs" ` - "$PSScriptRoot\dotnethome_x64.wxs" ` - $InstallFileswsx - - Write-Information "Candle output: $candleOutput" - - if($LastExitCode -ne 0) - { - $result = $false - Write-Information "Candle failed with exit code $LastExitCode." - } - - popd - return $result -} - -function RunLight -{ - $result = $true - pushd "$WixRoot" - - Write-Information "Running light.." - $CabCache = Join-Path $WixRoot "cabcache" - - $lightOutput = .\light.exe -nologo -ext WixUIExtension -ext WixDependencyExtension -ext WixUtilExtension ` - -cultures:en-us ` - manifests.wixobj ` - provider.wixobj ` - dotnethome_x64.wixobj ` - $InstallFilesWixobj ` - -b "$inputDir" ` - -b "$PSScriptRoot" ` - -reusecab ` - -cc "$CabCache" ` - -out $DotnetMSIOutput - - Write-Information "Light output: $lightOutput" - - if($LastExitCode -ne 0) - { - $result = $false - Write-Information "Light failed with exit code $LastExitCode." - } - - popd - return $result -} - -if(!(Test-Path $inputDir)) -{ - throw "$inputDir not found" -} - -Write-Information "Creating manifests MSI at $DotnetMSIOutput" - -if([string]::IsNullOrEmpty($WixRoot)) -{ - Exit -1 -} - -if(-Not (RunHeat)) -{ - Write-Information "Heat failed" - Exit -1 -} - -if(-Not (RunCandle)) -{ - Write-Information "Candle failed" - Exit -1 -} - -if(-Not (RunLight)) -{ - Write-Information "Light failed" - Exit -1 -} - -if(!(Test-Path $DotnetMSIOutput)) -{ - throw "Unable to create the manifests MSI." - Exit -1 -} - -Write-Information "Successfully created manifests MSI - $DotnetMSIOutput" - -exit $LastExitCode From 61774f69e89e2171718fcc7b5abfa3e6dc8bbd67 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 3 Nov 2021 09:08:58 -0700 Subject: [PATCH 2/6] Stop generating manifest MSI VS Redist NuGet package Reverts 41ef6e2cac15af6411c96ab5f4f9d0bb67655695 --- src/redist/targets/GenerateMSIs.targets | 22 ------------------- .../VS.Redist.Common.NetCore.Manifest.nuspec | 18 --------------- 2 files changed, 40 deletions(-) delete mode 100644 src/redist/targets/packaging/windows/clisdk/VS.Redist.Common.NetCore.Manifest.nuspec diff --git a/src/redist/targets/GenerateMSIs.targets b/src/redist/targets/GenerateMSIs.targets index d17a563da..0a08326bf 100644 --- a/src/redist/targets/GenerateMSIs.targets +++ b/src/redist/targets/GenerateMSIs.targets @@ -38,9 +38,6 @@ $(ArtifactsNonShippingPackagesDir)VS.Redist.Common.NetCore.SdkPlaceholder.$(Architecture).$(FullNugetVersion).nupkg $(MSBuildThisFileDirectory)packaging/windows/clisdk/VS.Tools.Net.Core.SDK.nuspec $(ArtifactsNonShippingPackagesDir)VS.Tools.Net.Core.SDK.$(Architecture).$(FullNugetVersion).nupkg - - $(MSBuildThisFileDirectory)packaging/windows/clisdk/VS.Redist.Common.NetCore.Manifest.nuspec - $(ArtifactsNonShippingPackagesDir)VS.Redist.Common.NetCore.Manifest.$(Architecture).$(FullNugetVersion).nupkg $(ArtifactsDir)bin/SdkResolver/$(Configuration) $(MSBuildThisFileDirectory)packaging/windows/clisdk/VS.Tools.Net.Core.SDK.Resolver.nuspec @@ -447,24 +444,6 @@ - - - - - - - - VS.Redist.Common.NetCore.Manifest.$ARCH$ - 1.0.0 - VS.Redist.Common.NetCore.Manifest.$ARCH$ - Microsoft - Microsoft - https://www.microsoft.com/net/dotnet_library_license.htm - https://github.com/dotnet/core-sdk - true - .NET Core $MAJOR_MINOR$ SDK Manifests ($ARCH$) Windows Installer MSI as a .nupkg for internal Visual Studio build consumption - © Microsoft Corporation. All rights reserved. - - - - - From 69a868b025d3a2532a391ab87f19ef2d110e8e1a Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 3 Nov 2021 09:40:39 -0700 Subject: [PATCH 3/6] Only download workload manifest MSIs on Windows and not ARM --- src/redist/targets/BundledManifests.targets | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/redist/targets/BundledManifests.targets b/src/redist/targets/BundledManifests.targets index ee574e06a..1fa77028a 100644 --- a/src/redist/targets/BundledManifests.targets +++ b/src/redist/targets/BundledManifests.targets @@ -31,7 +31,9 @@ [%(Version)] - + + + [%(Version)] From 3217a5c4a3765b89cfea3a704fbe51e1a19b5575 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 3 Nov 2021 09:41:43 -0700 Subject: [PATCH 4/6] Remove ALLOWMSIINSTALL property for workload manifest MSIs --- src/redist/targets/GenerateMSIs.targets | 1 - 1 file changed, 1 deletion(-) diff --git a/src/redist/targets/GenerateMSIs.targets b/src/redist/targets/GenerateMSIs.targets index 0a08326bf..903332900 100644 --- a/src/redist/targets/GenerateMSIs.targets +++ b/src/redist/targets/GenerateMSIs.targets @@ -292,7 +292,6 @@ @(BundledManifests->' - ', ' ') From 590cbca7eae32f5aa1a74d82300e498ab1092e59 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 3 Nov 2021 10:35:42 -0700 Subject: [PATCH 5/6] Include workload manifests wixobj file --- src/redist/targets/GenerateMSIs.targets | 1 + 1 file changed, 1 insertion(+) diff --git a/src/redist/targets/GenerateMSIs.targets b/src/redist/targets/GenerateMSIs.targets index 903332900..03a849533 100644 --- a/src/redist/targets/GenerateMSIs.targets +++ b/src/redist/targets/GenerateMSIs.targets @@ -360,6 +360,7 @@ -InformationAction Continue " /> + Date: Wed, 3 Nov 2021 23:14:42 -0700 Subject: [PATCH 6/6] Verify that workload manifest MSIs are signed --- src/redist/targets/BundledManifests.targets | 34 ++++++++++++++++++++- src/redist/targets/GenerateMSIs.targets | 3 +- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/redist/targets/BundledManifests.targets b/src/redist/targets/BundledManifests.targets index 1fa77028a..89ccd630f 100644 --- a/src/redist/targets/BundledManifests.targets +++ b/src/redist/targets/BundledManifests.targets @@ -22,7 +22,7 @@ %(Identity).Manifest-%(FeatureBand).Msi.$(MsiArchitectureForWorkloadManifests) $(NuGetPackageRoot)$([MSBuild]::ValueOrDefault('%(NupkgId)', '').ToLower())/$([MSBuild]::ValueOrDefault('%(Version)', '').ToLower()) $(NuGetPackageRoot)$([MSBuild]::ValueOrDefault('%(MsiNupkgId)', '').ToLower())/$([MSBuild]::ValueOrDefault('%(Version)', '').ToLower()) - %(RestoredMsiNupkgContentPath)/data/%(NupkgId).%(Version)-$(MsiArchitectureForWorkloadManifests).msi + $([MSBuild]::NormalizePath('%(RestoredMsiNupkgContentPath)/data/%(NupkgId).%(Version)-$(MsiArchitectureForWorkloadManifests).msi')) @@ -37,8 +37,40 @@ [%(Version)] + + + + + + $(PkgMicrosoft_DotNet_SignCheck)\tools\Microsoft.DotNet.SignCheck.exe + $(ArtifactsLogDir)\workloadmanifestsigncheck.log + $(ArtifactsLogDir)\workloadmanifestsigncheck.errors.log + + + + + + + + + + + + + + diff --git a/src/redist/targets/GenerateMSIs.targets b/src/redist/targets/GenerateMSIs.targets index 03a849533..52652e642 100644 --- a/src/redist/targets/GenerateMSIs.targets +++ b/src/redist/targets/GenerateMSIs.targets @@ -280,7 +280,8 @@ - + $(IntermediateOutputPath)WorkloadManifests.wxs