Repro
- Create a .csproj with multiple
<RuntimeIdentifiers> (e.g. <RuntimeIdentifiers>osx-x64;win-x64</RuntimeIdentifiers>)
dotnet restore
dotnet publish --no-restore --runtime win-x64
This will fail with
error NU1004: The packages lock file is inconsistent with the project dependencies so restore can't be run in locked mode. Please disable RestoreLockedMode MSBuild property or pass explicit --force-evaluate flag to run restore to update the lock file.
Automated repro
Download/unzip
publish_multi_rid.zip and run repro.bat
Additional context
Repro
<RuntimeIdentifiers>(e.g.<RuntimeIdentifiers>osx-x64;win-x64</RuntimeIdentifiers>)dotnet restoredotnet publish --no-restore --runtime win-x64This will fail with
Automated repro
Download/unzip
publish_multi_rid.zip and run repro.bat
Additional context
--no-restorewill cause different package versions to be used than would be produced the by originaldotnet restore. While being icky in general, this also causes breaks when NuGet lock files are used (e.g. Lock files prevent publishing when <RuntimeIdentifiers> is set NuGet/Home#8287)