Skip to content

Restore fails with error NU1605 when RuntimeIdentifier is set and ProjectReference is used to netcoreapp2.1 project #2364

@natemcmaster

Description

@natemcmaster

Repro
repro.zip

Create two projects:

  • src/src.csproj
    • TargetFramework = netcoreapp2.1
    • RuntimeIdentifer = win-x64
  • test/test.csproj
    • TargetFramework = netcoreapp2.1
    • ProjectReference to src/src.sproj

Run dotnet restore with the 2.1.301 SDK or newer

Result
Restore fails

/private/tmp/console1/test/test.csproj : error NU1605: Detected package downgrade: Microsoft.NETCore.App from 2.1.1 to 2.1.0. Reference the package directly from the project to select a different version.  [/private/tmp/console1/console1.sln]
/private/tmp/console1/test/test.csproj : error NU1605:  test -> src -> Microsoft.NETCore.App (>= 2.1.1)  [/private/tmp/console1/console1.sln]
/private/tmp/console1/test/test.csproj : error NU1605:  test -> Microsoft.NETCore.App (>= 2.1.0) [/private/tmp/console1/console1.sln]
  Restore failed in 396.65 ms for /private/tmp/console1/test/test.csproj.

Workarounds

  • Add <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> to test.csproj ( suggested by @dsplaisted )
  • Add <RuntimeFrameworkVersion>2.1.1</RuntimeFrameworkVersion> to test.csproj
  • Add <RuntimeIdentifier>win-x64</RuntimeIdentifier> and <OutputType>exe</OutputType> to test.csproj
  • Change <RuntimeIdentifier> to <RuntimeIdentifiers> (plural) in src.csproj

Details

.NET Core SDK (reflecting any global.json):
 Version:   2.1.301
 Commit:    59524873d6

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.13
 OS Platform: Darwin
 RID:         osx.10.13-x64
 Base Path:   /Users/namc/.dotnet/sdk/2.1.301/

cc @dsplaisted

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions