From 7d4dc3cc12cacf730974218fcff9c07b91985fa9 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Thu, 18 Feb 2021 16:39:00 +0100 Subject: [PATCH] Allow runtime packs to not be downloaded Simliar to the EnableTargetingPackDownload property, EnableRuntimePackDownload controls if a runtime pack is downloaded (i.e. when a RuntimeIdentifier is specified.) --- .../Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs | 4 +++- .../Microsoft.NET.Sdk.FrameworkReferenceResolution.targets | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs index d5b3e5d58d64..b8e0f86e8736 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs @@ -52,6 +52,8 @@ public class ProcessFrameworkReferences : TaskBase public bool EnableTargetingPackDownload { get; set; } + public bool EnableRuntimePackDownload { get; set; } + public ITaskItem[] FrameworkReferences { get; set; } = Array.Empty(); public ITaskItem[] KnownFrameworkReferences { get; set; } = Array.Empty(); @@ -286,7 +288,7 @@ var runtimeRequiredByDeployment } ProcessRuntimeIdentifier(hasRuntimePackAlwaysCopyLocal ? "any" : RuntimeIdentifier, runtimePackForRuntimeIDProcessing, runtimePackVersion, additionalFrameworkReferencesForRuntimePack, - unrecognizedRuntimeIdentifiers, unavailableRuntimePacks, runtimePacks, packagesToDownload, isTrimmable, includeInPackageDownload); + unrecognizedRuntimeIdentifiers, unavailableRuntimePacks, runtimePacks, packagesToDownload, isTrimmable, EnableRuntimePackDownload && includeInPackageDownload); processedPrimaryRuntimeIdentifier = true; } diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets index 32eb2dded808..bda1b4957748 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets @@ -48,8 +48,9 @@ Copyright (c) .NET Foundation. All rights reserved. - - true + + true + true @@ -78,6 +79,7 @@ Copyright (c) .NET Foundation. All rights reserved. TargetLatestRuntimePatch="$(TargetLatestRuntimePatch)" TargetLatestRuntimePatchIsDefault="$(_TargetLatestRuntimePatchIsDefault)" EnableTargetingPackDownload="$(EnableTargetingPackDownload)" + EnableRuntimePackDownload="$(EnableRuntimePackDownload)" KnownCrossgen2Packs="@(KnownCrossgen2Pack)" NETCoreSdkRuntimeIdentifier="$(NETCoreSdkRuntimeIdentifier)">