Skip to content

.NET Core 2.0 restore imports .NET Framework targets from packages #1166

@natemcmaster

Description

@natemcmaster

The implicit PackageTargetFallback in Microsoft.NET.Sdk.BeforeCommon.targets causes .NET Framework targets to be imported into .NET Core 2.0 projects.

Repro

Run dotnet restore on this:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="SQLitePCLRaw.lib.e_sqlite3.linux" Version="1.1.4" />
  </ItemGroup>

</Project>

SQLitePCLRaw.lib.e_sqlite3.linux contains a file in build/net35/SQLitePCLRaw.lib.e_sqlite3.linux.targets

Expected

build/net35/SQLitePCLRaw.lib.e_sqlite3.linux.targets should not be imported.

Actual

build/net35/SQLitePCLRaw.lib.e_sqlite3.linux.targets is imported because PackageTargetFallback is set to include net461.

Implicit PackageTargetFallback was added in #1133

cc @livarcocc @JunTaoLuo @ericsink

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions