“术语“ add-migration”未被识别为cmdlet的名称” visual studio 2019

问题描述 投票:0回答:1

enter image description hereenter image description here

我正在尝试使用实体框架工作核心,并打开一个新的asp.net核心项目。当我尝试通过nuget软件包管理器安装Microsoft.EntityFrameworkCore.SqlServer时,出现以下错误。

软件包Microsoft.EntityFrameworkCore.SqlServer 3.0.0与net461(.NETFramework,Version = v4.6.1)不兼容。软件包Microsoft.EntityFrameworkCore.SqlServer 3.0.0支持:netstandard2.1(.NETStandard,Version = v2.1)

当我单击此按钮时,我将发送到.csproj文件。

在该文件中,我将目标框架从<TargetFramework>net461</TargetFramework>至错误提示为<TargetFramework>netstandard2.1 </TargetFramework>

这样做可以消除错误,但是当我在软件包管理器控制台中使用命令'add-migration'时,我会收到此错误。

“术语“ add-migration”未被识别为cmdlet的名称”

我不确定该怎么做。请帮忙。我希望我已经清楚地解释了这个问题。

删除project.assets文件或更新nuget软件包管理器,并使用命令“ enable-migrations”均无效。

enter image description hereenter image description here

c# asp.net-core entity-framework-core code-first
1个回答
0
投票

我已经遇到了相同的问题,并且这些步骤解决了该问题。

1)工具-> Nuget软件包管理器->软件包管理器设置

2)常规选项卡

3)清除所有NuGet缓存

4)重新启动Visual Studio

© www.soinside.com 2019 - 2024. All rights reserved.