Skip to content

Fix AppHost pack prebuilt usage in source-build#37672

Merged
dagood merged 1 commit into
dotnet:mainfrom
dagood:fix-prebuilt-apphost
Oct 21, 2021
Merged

Fix AppHost pack prebuilt usage in source-build#37672
dagood merged 1 commit into
dotnet:mainfrom
dagood:fix-prebuilt-apphost

Conversation

@dagood
Copy link
Copy Markdown
Member

@dagood dagood commented Oct 19, 2021

Fix AppHost pack prebuilt usage in source-build

This change removes the NetCoreTargetingPackRoot override in some cases during source-build to avoid unnecessarily downloading the apphost pack as a prebuilt dependency. I also updated the comment on the override to be more descriptive (based on git blame) and added details on why/when it needs to be disabled for source-build.

/cc @dougbu

@dagood dagood requested a review from Pilchie as a code owner October 19, 2021 03:30
@Pilchie Pilchie requested a review from wtgodbe October 19, 2021 15:42
@Pilchie Pilchie added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Oct 19, 2021
@Pilchie
Copy link
Copy Markdown
Member

Pilchie commented Oct 19, 2021

Looks fine to me, but would like @wtgodbe or @dougbu to sign off on it.

Comment thread Directory.Build.props Outdated
Comment on lines 213 to 214
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually doesn't work because of props/targets ordering. This is a .props file, but the SDK sets UseAppHost to true in Microsoft.NET.RuntimeIdentifierInference.targets. 🙁 At the point this condition is evaluted, UseAppHost is still empty string. I'm not sure how I didn't catch it not working in my test source-build. @MichaelSimons caught it after the 6.0.1xx patch version of this PR went through a build.

I think all I need to do is remove the or '$(UseAppHost)' != 'true' part of the condition and change this:

https://github.com/dotnet/aspnetcore/blob/00c1aae47f2dd342be9b7a5243afb6fdcbfc822a/src/Framework/App.Ref/src/Microsoft.AspNetCore.App.Ref.csproj#L212-L215

to match the condition on the runtime project:

https://github.com/dotnet/aspnetcore/blob/00c1aae47f2dd342be9b7a5243afb6fdcbfc822a/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj#L512-L516

(I noticed that only ref packs were being "installed" during source-builds, not runtime packs. We don't care about tests in source-build, so might as well disable both.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's my thought above as well.

Comment thread Directory.Build.props Outdated
Comment on lines 202 to 203
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the SDK can download targeting packs and reference them from the .nuget/packages/ folder, this isn't entirely true.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pulled this from the commit that added this line via git blame to put more context in the comment itself alongside the source-build comment. Would this be better? (Basically, remove required:)

Override the SDK default and point to local .dotnet folder. This is done to work around limitations in the way the .NET SDK finds shared frameworks and targeting packs. It allows tests to use the shared frameworks and targeting packs that were just built.

Comment thread Directory.Build.props Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ick, I can see how that would be a problem.

Comment thread Directory.Build.props Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave this alone. This property controls where Microsoft.AspNetCore.App.Ref and Microsoft.AspNetCore.App.Runtime lay out their content for local tests. Should instead conditionalize the App.Ref target _InstallTargetingPackIntoLocalDotNet i.e. copy over https://github.com/dotnet/aspnetcore/blob/main/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj#L514

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yeah, in addition to removing the '$(UseAppHost)' != 'true' part, I should be able to move the source-build condition onto the NetCoreTargetingPackRoot property because that's the one that's actually giving us trouble. (We ended up with the same conclusion about _InstallTargetingPackIntoLocalDotNet but I hadn't thought about the simplification on this end. 👍)

Comment thread Directory.Build.props Outdated
Comment on lines 213 to 214
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's my thought above as well.

@dagood dagood force-pushed the fix-prebuilt-apphost branch from 3f477ec to 2662685 Compare October 20, 2021 21:18
@dagood
Copy link
Copy Markdown
Member Author

dagood commented Oct 20, 2021

@dougbu @wtgodbe This is ready for another pass. I'm running it through a tarball build in dotnet/installer#12469 and locally.

@dagood dagood marked this pull request as ready for review October 20, 2021 21:22
<!-- Workaround https://github.com/dotnet/sdk/issues/2910 by copying targeting pack into local installation. -->
<Target Name="_InstallTargetingPackIntoLocalDotNet"
DependsOnTargets="_ResolveTargetingPackContent"
Condition="'$(DotNetBuildFromSource)' != 'true'"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes more sense to me 👍

@dagood dagood requested a review from dougbu October 21, 2021 00:42
@dagood dagood merged commit 2984e3b into dotnet:main Oct 21, 2021
@dagood dagood deleted the fix-prebuilt-apphost branch October 21, 2021 20:35
@ghost ghost added this to the 7.0-preview1 milestone Oct 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants