From 61991b51b7b9b57b5e337f4e52f4acb2b023f8ba Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Sun, 20 Nov 2022 11:48:29 +0100 Subject: [PATCH] Add switch to disable apphost pack restore Contributes to https://github.com/dotnet/runtime/issues/58109 In dotnet/runtime we live build targeting packs, runtime packs and app host packs. For the former two, switches already exist to disable nuget restore: - EnableTargetingPackDownload - EnableRuntimePackDownload The latter one doesn't yet have such a switch and therefore is always restored by NuGet. In the cases where want to use the live built apphost pack, restore fails, i.e. from a runtime build: `artifacts/bin/trimmingTests/projects/Microsoft.Extensions.DependencyInjection.TrimmingTests/ActivatorUtilitiesTests/osx-x64/project.csproj(0,0): error NU1102: (NETCORE_ENGINEERING_TELEMETRY=Build) Unable to find package Microsoft.NETCore.App.Host.osx-x64 with version (= 8.0.0)` --- .../Microsoft.NET.Sdk.FrameworkReferenceResolution.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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..0f6c389cb85a 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 @@ -146,7 +146,7 @@ Copyright (c) .NET Foundation. All rights reserved. DotNetIjwHostLibraryNameWithoutExtension="$(_DotNetIjwHostLibraryNameWithoutExtension)" RuntimeGraphPath="$(BundledRuntimeIdentifierGraphFile)" KnownAppHostPacks="@(KnownAppHostPack)" - NuGetRestoreSupported="$(_NuGetRestoreSupported)" + NuGetRestoreSupported="$([MSBuild]::ValueOrDefault('$(EnableAppHostPackDownload)', '$(_NuGetRestoreSupported)'))" NetCoreTargetingPackRoot="$(NetCoreTargetingPackRoot)">