Entity Framework Core 2.0 on .NET 4.6.1

前端 未结 4 2142
天命终不由人
天命终不由人 2020-12-05 14:23

Microsoft just announced that Entity Framework Core 2.0 will now run on .NET Standard 2.0.

.Net Standard 2.0 is compatible (if that\'s the right term here) with .NE

相关标签:
4条回答
  • 2020-12-05 15:00

    go to your .csproj and change your TargetFramework

    <PropertyGroup>
      <PackageTargetFallback>netstandard2.0</PackageTargetFallback>
    </PropertyGroup>
    

    to it

      <PropertyGroup>
        <TargetFramework>netcoreapp2.0</TargetFramework>
      </PropertyGroup>
    
    0 讨论(0)
  • 2020-12-05 15:03

    It seems that in order to include .NET Standard 2.0 libraries within a .NET 4.6.1 project you need to include the NetStandard.Library.NetFramework NuGet package.

    Example of current version in the packages.config file:

    <package id="NETStandard.Library.NETFramework" version="2.0.0-preview1-25305-02" targetFramework="net461" />
    
    0 讨论(0)
  • 2020-12-05 15:10

    In addition to installing the NETStandard.Library.NETFramework package, you may also have to tell older NuGet clients that it really is compatible by adding the following to your *.csproj file.

    <PropertyGroup>
      <PackageTargetFallback>netstandard2.0</PackageTargetFallback>
    </PropertyGroup>
    
    0 讨论(0)
  • 2020-12-05 15:14

    Run Update-Package via Package Manager Console, this will somehow magically update all packets including .Net Core which by default would prevent you from updating them via Nuget, because it needs NetCore 2.0 target, while you're targeting 4.6.1 even though it should be compatible.

    Project will work perfectly if you do this and hopefully soon updates will be viable directly via nuget as they meant to be.

    0 讨论(0)
提交回复
热议问题