Skip to content

'dotnet publish --no-restore --runtime X' fails when multiple RuntimeIdentifers are listed in the project file #3383

@bergbria

Description

@bergbria

Repro

  1. Create a .csproj with multiple <RuntimeIdentifiers> (e.g. <RuntimeIdentifiers>osx-x64;win-x64</RuntimeIdentifiers>)
  2. dotnet restore
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions