本文介绍了.NET 4.6.1类库上的“添加迁移”需要'System.ValueTuple,版本= 0.0.0.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将.net标准类库从Entity Framework Core 1.1升级到Entity Framework 2.0

I upgraded a .net standard class library from Entity Framework Core 1.1 to Entity Framework 2.0

我试图在Entity Framework Core类库上运行添加迁移面向.net Framework 4.6.1

I am trying to run Add-Migration on an Entity Framework Core Class Library that targets .net framework 4.6.1

Add-Migration MyMigration

但是随后出现以下错误

我将nuget包System.ValueTuple添加到了csproj中,但仍然出现错误

I added the nuget package of System.ValueTuple to my csproj but I still get the error

 <PackageReference Include="System.ValueTuple" Version="4.4.0" />


推荐答案

添加 AutoGenerateBindingRedirects GenerateBindingRedirectsOutputType 到类库中csproj

Add AutoGenerateBindingRedirects and GenerateBindingRedirectsOutputType to your class library csproj

eg

<PropertyGroup>
    <TargetFramework>net461</TargetFramework>

    ....

    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>

这篇关于.NET 4.6.1类库上的“添加迁移”需要'System.ValueTuple,版本= 0.0.0.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 23:17