diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ResolveAppHosts.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ResolveAppHosts.cs index eb0cee610880..c48734d35350 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/ResolveAppHosts.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/ResolveAppHosts.cs @@ -54,6 +54,8 @@ public class ResolveAppHosts : TaskBase public bool NuGetRestoreSupported { get; set; } = true; public string NetCoreTargetingPackRoot { get; set; } + + public bool EnableAppHostPackDownload { get; set; } = true; [Output] public ITaskItem[] PackagesToDownload { get; set; } @@ -276,7 +278,6 @@ private ITaskItem GetHostItem(string runtimeIdentifier, string hostRelativePathInPackage = Path.Combine("runtimes", bestAppHostRuntimeIdentifier, "native", hostNameWithoutExtension + (isExecutable ? ExecutableExtension.ForRuntimeIdentifier(bestAppHostRuntimeIdentifier) : ".dll")); - TaskItem appHostItem = new TaskItem(itemName); string appHostPackPath = null; if (!string.IsNullOrEmpty(TargetingPackRoot)) @@ -289,7 +290,7 @@ private ITaskItem GetHostItem(string runtimeIdentifier, appHostItem.SetMetadata(MetadataKeys.PackageDirectory, appHostPackPath); appHostItem.SetMetadata(MetadataKeys.Path, Path.Combine(appHostPackPath, hostRelativePathInPackage)); } - else + else if (EnableAppHostPackDownload) { // C++/CLI does not support package download && dedup error if (!NuGetRestoreSupported && !packagesToDownload.ContainsKey(hostPackName)) 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 c66580e5e4e5..599cf7c6e11a 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 @@ -147,6 +147,7 @@ Copyright (c) .NET Foundation. All rights reserved. RuntimeGraphPath="$(BundledRuntimeIdentifierGraphFile)" KnownAppHostPacks="@(KnownAppHostPack)" NuGetRestoreSupported="$(_NuGetRestoreSupported)" + EnableAppHostPackDownload="$(EnableAppHostPackDownload)" NetCoreTargetingPackRoot="$(NetCoreTargetingPackRoot)">