Skip to content

Build issue when targeting .NET core 2.1 on machine with only .NET Core SDK 2.2 #3272

Open
@kakiyama1018

Description

@kakiyama1018

I'm trying to ship some code samples to users that will work regardless of whether they have .NET SDK 2.1 or 2.2.

According to...
https://docs.microsoft.com/en-us/dotnet/core/versions/selection
... it states that:

"A given SDK supports a fixed set of frameworks, capped to the target framework of the runtime it ships with. For example, the .NET Core 2.0 SDK includes the .NET Core 2.0 runtime, which is an implementation of the netcoreapp2.0 target framework. The .NET Core 2.0 SDK supports netcoreapp1.0, netcoreapp1.1, and netcoreapp2.0 but not netcoreapp2.1 (or higher). You install the .NET Core 2.1 SDK to build for netcoreapp2.1."

As such, I've chosen to have...
netcoreapp2.1.
... in the .csproj in hopes that the sample can be built on machines that have either .NET Core SDK 2.1 or 2.2.

However, we are running into the following build-time error on machines that simply have .NET Core SDK 2.2 installed:

error NU1202: Package Microsoft.NETCore.App 2.2.0 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package Microsoft.NETCore.App 2.2.0 supports: netcoreapp2.2 (.NETCoreApp,Version=v2.2)

Why can't we build an application that targets 2.1 on a machine that has .NET Core SDK 2.2, as the documentation implies to be allowed (since the target of 2.1 is lower than the SDK version that is installed on the machine)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions