-
Notifications
You must be signed in to change notification settings - Fork 252
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
packages.lock.json broken with Sdk-Style C# project targeting net5.0-windows #10901
Comments
I could repro with the same repro steps above.
However, the project.assets.json has the following contents:
So this line found the TFMs are different, hence the restore failed. |
This issue makes locked-mode completely unusable when targeting |
FYI @aortiz-msft, @nkolev92 |
We can repro this issue on .NET 6.0, and the packages.lock.json file is blank after restoring project. |
I've just encountered this problem. Using nuget.exe v5.10.0-preview.2, the error message says:
|
As a workaround, try setting TargetFramework to:
taken from dotnet/sdk#14553 although I don't know for sure if the two issues are related |
Fix is currently targeting .NET 6 Preview 7. |
@aortiz-msft Will this be back-ported to .NET 5? |
@reduckted @johnendev - Have you had a chance to try .NET 6 Preview 7 (or Visual Studio 2022 Preview 3) and confirm that the issue is fixed there? We backport fixes based on impact, so please thumbs up the previous comment if you'd like the fix backported to .NET 5. |
Thanks @aortiz-msft. 😄 I've just tried using the .NET SDK 6 preview (specifically 6.0.100-preview.7.21379.14), and it does fix the problem for me. Unfortunately, I don't think using the preview SDK is an option for me at the moment, so back-porting the fix would be much appreciated. |
This issue has been moved from a ticket on Developer Community.
When using a Sdk-Style C# project targeting net5.0-windows with package references it is not possible to lock the nuget packages via packages.lock.json.
The restore fails both in commandline and in visual studio.
"error NU1004: The packages lock file is inconsistent with the project dependencies so restore can't be run in locked mode. Disable the RestoreLockedMode MSBuild property or pass an explicit --force-evaluate option to run restore to update the lock file."
Steps to reproduce:
dotnet restore --force-evaluate
to create the packages.lock.json filedotnet restore
Error occurs whether a nuget package is installed or not. The same code works as expected when the targetframework is another framework, e.g.
net5.0
ornet461
.Original Comments
Feedback Bot on 5/20/2021, 06:43 PM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Original Solutions
(no solutions)
The text was updated successfully, but these errors were encountered: