-
Notifications
You must be signed in to change notification settings - Fork 255
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
Restore with static graph evaluation fails with an NRE when a TargetFramework
is specified
#11761
Comments
cc @jeffkl Did some quick debugging, and we basically end up with a project with nodes, but no outer node as TargetFramework is always set globally, so technically we can't discover an outer build project. |
Possible duplicate of #11680. Basically, static graph doesn't give NuGet the full representation of the project graph when you specify a TargetFramework because it doesn't think it needs to enumerate the values of TargetFrameworks. I think we'll need to update MSBuild static graph to have a mode where it always loads the full graph even if it could get a scoped version. |
@nkolev92 can you try this and tell me what happens?
By specifying a |
That does workaround it. |
Maybe for implicity restore |
Not sure what you mean by ignoring certain properties. I have a PR that might provide you some context about how I discovered this: NuGet/NuGet.Client#4587 |
@nkolev92 for example:
The global property Where we get global properties to pass to static graph restore: Where static graph restore parses global properties and could ignore certain ones: |
I don't think we should do that. Would appreciate feedback to NuGet/NuGet.Client#4587 |
I'm only talking about restore. Do we ever want to restore for a single target framework? I'm just saying whenever NuGet restores, it never needs to tell MSBuild the TargetFramework property during evaluation of the outer project.
Maybe we should chat about this so I get a better understanding 😄 |
FWIW the SDK explicitly performs a restore without TargetFramework if it detects one provided by a user at the command line (either via |
Take the following project for example:
Run the following command:
Actual
See output below.
Run it without static graph, and note that there's no failure.
Expected
Discovered this while working on #11653.
Note that when fixing this, we might need to do the same thing as the fix in #11653
The text was updated successfully, but these errors were encountered: