问题描述
我正在观看有关ASP.NET CORE身份的教程,其中讲师使用Visual Studio
通过脚手架添加身份来添加身份,但是现在我正在使用Rider IDE
,但我没有看到这样的选择就可以了,所以我相信这是Visual Studio的专有功能。
那么有没有办法在Rider IDE上实现它呢?还是我不得不在Visual Studio上这样做,然后又回到骑手身边?
解决方法
从 Rider 中的终端(默认位于 IDE 底部),您可以运行以下命令 (Full Reference)。
dotnet tool install -g dotnet-aspnet-codegenerator
如果您已经安装了 dotnet-aspnet-codegenerator
工具,您可能需要更新它:
dotnet tool update -g dotnet-aspnet-codegenerator
确保您已切换到项目目录(如果尚未切换到解决方案根目录,cd ProjectName
。
然后通过 NuGet 选项卡或命令行 (Microsoft.VisualStudio.Web.CodeGeneration.Design
) 安装 dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
包。
然后运行以下命令生成默认项目:
dotnet aspnet-codegenerator identity
身份区域将填充您项目中的 Data
和 Pages
文件夹。
一个真实世界的例子(使用现有的 DbContext 并使用 Sqlite)是:
dotnet aspnet-codegenerator identity -dc ApplicationDbContext -gl -sqlite -f