Rider IDE 中的 NuGet 管理器控制台在哪里?

34

我是.NET平台的新手。有时候我会遇到Visual Studio的问题,所以我决定使用Rider。这又让我重新振作起来了(我已经使用JetBrains产品2年了)。但是我找不到NuGet控制台(在Visual Studio中被称为NuGet控制台)。

它在哪里?


1
Visual Studio中的NuGet控制台基于PowerShell,而Rider目前不支持它。未来版本中将实现此功能(可能在正式发布后)。 - AndreyAkinshin
7个回答

13

1
NuGet控制台在VS中基于PowerShell,而Rider目前不支持它。将在未来版本中实现。 - Ali Dehqan
我是.NET世界的新手。据我所知,Entity Framework是一个库,可以使与数据存储的交互更加容易。这与IDE支持包管理器的shell有什么关系呢?我错过了什么吗? - Blieque
1
@Blieque 是的。您必须使用为此编写的包管理器控制台或GUI界面。 - TuralAsgar

8

1
在2020.2中不支持此功能。我创建了一个asp.net core解决方案并安装了ef。Tools/Entity Framework不存在。 - hce
@hce 我正在使用 Rider 2020.2.1 ,它是可用的。你尝试过在“资源管理器”视图中右键单击项目吗?请查看我的编辑回答及其图片。 - Noam Gal
@Noam_Gal 我理解你的困惑:我正在使用 Microsoft.EntityFrameworkCore v3.1.7,而你正在使用 Microsoft.EntityFramework。Rider不支持EntityFramework的核心版本。 - hce
@hce 你说得对。对于Core,目前还没有这样的解决方案,只有这篇文章:https://blog.jetbrains.com/dotnet/2017/08/09/running-entity-framework-core-commands-rider/ - Noam Gal
如果您在右键单击后没有找到选项,则首先必须安装“EntityFramework”包,然后您将看到Entity Framework的所有选项。 - NM Naufaldo

4
您可以像这样在 Windows 上“DbContext 所在的位置”使用 PowerShell:

dotnet ef


dotnet ef migrations add [名称]


1
没有像VS之外的NPC那样的东西,所以你应该在Windows PowerShell中寻找替代命令。 - behzad chhizari
谁给这个答案打了-1?为什么? - hce
这是一种大致等效的调用相同/类似命令的方法,但语法不同,并且解决问题的方式也不同。 - Dave Cousineau
在Linux中,使用命令“dotnet ef database update”在项目文件夹下更新数据库对我有效。 - Brian
这些命令必须在项目文件夹下使用,而不是 DbContext 文件夹下。 - amir_a14

4
如果您需要运行实体框架命令,例如:
dotnet ef migrations add "initialSetup"

然后打开终端:Alt+f12 或 双击shift并输入“terminal”。

然后运行:

dotnet tool install --global dotnet-ef

然后(确保你在项目目录下):

dotnet ef migrations add "initialSetup"

4
虽然 Rider 现在已经添加了迁移的用户界面,但是不幸的是,如果您使用最新的 dotnet 功能,UI 将无法正常工作。
例如,如果我创建了没有 Startup 类文件的项目,则 UI 将不允许我继续:

enter image description here

enter image description here

但是我尝试了这些命令,它们有效:

dotnet tool install --global dotnet-ef

# You can type the DbContext manually now!
dotnet ef migrations add 'initial' --project src/IdentityServer/IdentityServer.csproj --context PersistedGrantDbContext

enter image description here

然后我执行:
dotnet ef database update --project src/IdentityServer/IdentityServer.csproj --context ConfigurationDbContext

现在数据库已经更新并包含了所有表格: enter image description here

0

他们还没有实现包管理器控制台。所以你必须使用Visual Studio。


-4
你可以使用终端工具窗口。或者 NuGet 管理器(GUI)...

2
我知道在哪里可以打开终端。但是NuGet控制台不同(它存在于Visual Studio中)。 - TuralAsgar

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接