-
Notifications
You must be signed in to change notification settings - Fork 265
Description
Details about Problem
dotnet.exe --version (if appropriate): 2.2.300 and 3.0.100-preview5-011568
Automated repro
Download/unzip restore_multi_RID_repro.zip and run repro.bat
Detailed repro steps so we can see the same problem
-
Create a csproj with multiple RIDs specified in
<RuntimeIdentifiers>(e.g.<RuntimeIdentifiers>osx-x64;win-x64</RuntimeIdentifiers>) -
dotnet restore --use-lock-file
At this point, simply running dotnet publish won't actually create self-contained applications (e.g. a .exe file for windows). This is annoying, but not really Nuget's fault.
Normally, this would be resolved by running dotnet publish -r win-x64. However, this will actually mutate the lock file that was just generated.
If I enable locked mode in the publish command (this really should be a top-level flag, btw) via dotnet publish -p:RestoreWithLockFile=true -p:RestoreLockedMode=true -r 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
Effectively, publishing doesn't play nicely with lock files when multiple RuntimeIdentifiers are in the csproj.
Presumably there's something in the restore target that looks at the <RuntimeIdentifier> property and discards <RuntimeIdentifiers> if it's set.