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
NU1702 error is cryptic when referencing a project that targets .netfx and .netcore but has TargetPlatformIdentifier set to Windows #13417
Comments
Hey @kellyanng I see a couple of things being called out here, so I wanted to look at them separately:
What would you like to see different here? For context, here's the package equivalent:
Error:
This one is actually mixing the freeform string (TargetFramework value) and the actually TFM values. I think that one could use some work too. For context, when I try that, I see:
which isn't perfect, but better than the msbuild error IMO. Any chance you can zip-up a project that reproes the error? |
Sorry, I got so focused on giving the repro steps for the example that I don't think I did a good job explaining why this was so painful for us and how to make this better.
And you're correct, on my simplified repo once I removed net472 from WithWindows I do now see error NU1201 (which is a super-useful error!). I didn't notice that while creating the simplified repro and I just confirmed that I don't see it in our actual repro from our more complex build system (regardless of whether I built from msbuild or Visual Studio). I've dropped a zipped version of my minimal repo. (Open the WithWindows\WithWindows.sln file to repro), but it seems like you've seen most of the errors already. |
Ah, on my actual (i.e. complex repro), I just ran "msbuild /t:restore" and then I got the NU1201 error when my library being consumed had net8.0 and not net472. But I didn't get it until I explicitly ran that NuGet restore. Not sure if that helps you... |
That's actually helpful, cause we're now seeing the same things :D The gist is that MSBuild and NuGet both try to raise errors and unfortunately it seems like you'd get a different one depending on which component is raising it. Those need to be aligned. These are all very fixable things, especially with all the context, including the missing doc: NuGet/docs.microsoft.com-nuget#2544. |
NuGet Product Used
MSBuild.exe
Product Version
Visual Studio 17.9.6 so presumably the same msbuild
Worked before?
Unknown
Impact
It bothers me. A fix would be nice
Repro Steps & Context
Repro steps:
(I've reproed this within Visual Studio 2022 and from command line, simplified instructions here are from Visual Studio 2022)
Its project file will look like this:
Actual Result:
Expected Result:
I would expect an error to help me realize that because my first project is limited to Windows that my consuming project would need to be as well. It's really unclear as a user why this would fall back to net472.
More Details:
If I remove the net472 target from the WithWindows project, I get the slightly more helpful:
This as least gives me a better clue as to why my project is failing (something about my TargetFrameworks is definitely mismatching, but it's not clear why). But it still could have a lot clearer instructions that this is failing due to the TargetPlatformIdentifier not matching.
Verbose Logs
No response
The text was updated successfully, but these errors were encountered: