dotnet/aspnetcore: Fix AppHost pack prebuilt usage in source-build (#12441)

This commit is contained in:
Davis Goodin 2021-10-19 10:46:38 -05:00 committed by GitHub
parent 6834fb954d
commit c26605442b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,41 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Davis Goodin <dagood@microsoft.com>
Date: Mon, 18 Oct 2021 18:45:16 -0500
Subject: [PATCH] Fix AppHost pack prebuilt usage in source-build
This avoids downloading a prebuilt apphost pack.
Upstream PR: https://github.com/dotnet/aspnetcore/pull/37672
---
Directory.Build.props | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/Directory.Build.props b/Directory.Build.props
index dc1f355411..e2dea35567 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -197,9 +197,21 @@
<!-- The location of the local installation of the .NET Core shared framework. -->
<PropertyGroup>
- <LocalDotNetRoot>$(RepoRoot).dotnet\</LocalDotNetRoot>
- <!-- Override the SDK default and point to local .dotnet folder. -->
- <NetCoreTargetingPackRoot>$(LocalDotNetRoot)packs\</NetCoreTargetingPackRoot>
+ <!--
+ Override the SDK default and point to local .dotnet folder. This is required to work around
+ several limitations in the way the .NET SDK finds shared frameworks and targeting packs. It
+ allows tests to use shared frameworks and targeting packs.
+
+ However, source-build needs this to not happen while building projects that rely on the
+ AppHost framework pack. Source-build installs an SDK in a custom location outside this
+ repository, and setting NetCoreTargetingPackRoot to a different location causes source-build
+ to restore the AppHost pack as a prebuilt rather than using the one that's present in the SDK.
+
+ This condition still allows the Microsoft.AspNetCore.App.Ref and .Runtime projects to publish
+ to this location, so they don't modify the existing SDK being used by source-build.
+ -->
+ <LocalDotNetRoot Condition="'$(DotNetBuildFromSource)' != 'true' or '$(UseAppHost)' != 'true'">$(RepoRoot).dotnet\</LocalDotNetRoot>
+ <NetCoreTargetingPackRoot Condition="'$(LocalDotNetRoot)' != ''">$(LocalDotNetRoot)packs\</NetCoreTargetingPackRoot>
</PropertyGroup>
<Import Project="eng\tools\RepoTasks\RepoTasks.tasks" Condition="'$(MSBuildProjectName)' != 'RepoTasks' AND '$(DesignTimeBuild)' != 'true'" />