Skip to content
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

NU1004 after installing .NET 9 SDK #13941

Open
Bouke opened this issue Nov 19, 2024 · 1 comment
Open

NU1004 after installing .NET 9 SDK #13941

Bouke opened this issue Nov 19, 2024 · 1 comment

Comments

@Bouke
Copy link

Bouke commented Nov 19, 2024

NuGet Product Used

dotnet.exe

Product Version

9.0.100

Worked before?

8.0.301

Impact

It's more difficult to complete my work

Repro Steps & Context

We're using repeatable package restores in our .NET build pipeline. However as Azure DevOps windows-2022 version 20241113.3.0 started rolling out to agents, our build has been failing:

error NU1004: The project's runtime identifiers have changed from. Project's runtime identifiers: win-x86, lock file's runtime identifiers win7-x86.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.

We're still targeting .NET 8, not .NET 9, so I don't understand why this is now failing. This is seemingly related to NuGet yet again changing identifiers between versions and the lockfiles not being compatible between SDKs?

We've since tried updating the lockfiles, which makes the build succeed when .NET 9 SDK is installed. However as some agents are still running 20241021.1.0, the updated lockfiles will fail on those. This is not a great situation to be in. Also updating the lockfiles requires all our developers to install .NET 9 SDK, which is something we would like to avoid.

Verbose Logs

Also reported to Azure DevOps.

@dsplaisted
Copy link

This is related to a RID Graph change that we did in .NET 8. There was a related change that applies to projects targeting .NET Framework that went into the .NET 9 SDK: dotnet/sdk#36848

If you want to try to avoid updating your lock files you should be able to set the RuntimeIdentifier property to win7-x86 in projects when targeting .NET Framework. You could probably instead set the UseRidGraph property to true, but that would revert to the .NET 7 behavior and would require a lock file update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants