-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Don't add AOT package in restore for < net7 #31201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you check if the other publish scenarios have the same problem? I think you could get it with PublishReadyToRun (maybe you need to opt into crossgen2) on downlevel TFMs too.
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for following up on this!
Looking at this a second time, I don't think adding a TFM condition to the task is a good idea. The source of truth for which TFMs are supported by the various scenarios (not just AOT) lives in https://github.com/dotnet/installer/blob/main/src/redist/targets/GenerateBundledVersions.targets, and ProcessFrameworkReferences
is the current choke point that produces errors for all of these scenarios. I've been leaning on this to improve the error messages (see #32943 and #33041).
The current restore behavior (restoring for all TFMs) is by design per #30814 (comment), so if we're unhappy with this behavior I think we should be looking at a broader solution that changes the design.
Fixes #30814.
In order to avoid errors for invalid RIDs for AOT during restore, we need to avoid trying to restore a package for ILC when TFM < 7. Then, we need to warn during publish when there are no ILC packages found during restore to make sure we don't still go through with publish with PublishAOT=true and TFM<7.