.NET核心身份 - 脚手架页面而无需覆盖现有文件



i使用IDENTITY具有.NET Core 2.2 MVC应用。由于我使用的是Mac的Visual Studio,因此我必须使用CLI来踩下身份文件。最初,我只需要几个文件,因此我使用以下命令来生成我需要的文件:

dotnet aspnet-codegenerator identity --files="Account.Manage.ChangePassword;Account.Register;Account.ResetPassword;Account.ResetPasswordConfirmation;Account.Manage.SetPassword;Account.Manage.Index"

我现在尝试通过运行来生成另一个文件:

dotnet aspnet-codegenerator identity --files="Account.Manage.EnableAuthenticator"

,但我会收到以下错误:存在以下文件。使用" - 力"覆盖:区域/身份/数据/safdtoolsidentitydbcontext.cs区域/身份/页面/帐户/Manage/_managenav.cshtml区域/身份/页面/帐户/管理/ManageNavpages.cs

是否可以在不覆盖现有文件的情况下生成其他文件?我不想失去我已经进行的任何自定义。

,如果我使用 - force仅将覆盖错误中的3个文件,或者我已经生成的每个文件都会被覆盖?

每个文件名(例如Account.Manage.EnableAuthenticator(包含几个文件,这些文件列出了identitygeneratorfilesconfig.json templete中的列表:

https://github.com/aspnet/scaffolding/blob/release/2.2/src/src/vs.web.mvc.mvc/identity/bootstrap4_isteritygeneratorgeneratorfilesconfilesconfilesconfilesconfilesconfilesconvilescon#l301

当前似乎将覆盖现有文件,而找不到禁用行为的选项,您可以使用dotnet aspnet-codegenerator identity --listFiles,它将显示存在需要使用--force覆盖的文件。

,如果我使用 - force仅将覆盖错误中的3个文件,或者我已经生成的每个文件都会被覆盖?

它将覆盖3个文件,您可以复制/保存代码的自定义部分,将代码的该部分粘贴到新的创建文件。

最新更新