.NET Core Identity - 在不覆盖现有文件的情况下搭建页面
.NET Core Identity - Scaffold pages without overriding existing files
我有一个使用 Identity 的 .NET Core 2.2 MVC 应用程序。由于我将 Visual Studio 用于 Mac,因此我不得不使用 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"
但我收到以下错误:
存在以下文件。使用“--force”覆盖:Areas/Identity/Data/SAFDtoolsIdentityDbContext.cs
Areas/Identity/Pages/Account/Manage/_ManageNav.cshtml
Areas/Identity/Pages/Account/Manage/ManageNavPages.cs
是否可以在不覆盖现有文件的情况下生成额外的文件?我不想丢失我已经进行的任何自定义设置。
此外,如果我使用 --force 只会覆盖错误中的 3 个文件,还是会覆盖我已经生成的所有文件??
每个文件名(例如Account.Manage.EnableAuthenticator
)包含几个文件,这些文件在identitygeneratorfilesconfig.json
模板中列出:
目前似乎会覆盖现有文件并且找不到禁用该行为的选项,您可以使用dotnet aspnet-codegenerator identity --listFiles
,它会显示需要使用--force
覆盖的现有文件。
Also, if I use --force will only the 3 files in the error get overwritten or will every file I already generated be overwritten??
它将覆盖这 3 个文件,您可以 copy/save 自定义部分代码,将该部分代码粘贴到新创建的文件中。
我有一个使用 Identity 的 .NET Core 2.2 MVC 应用程序。由于我将 Visual Studio 用于 Mac,因此我不得不使用 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"
但我收到以下错误: 存在以下文件。使用“--force”覆盖:Areas/Identity/Data/SAFDtoolsIdentityDbContext.cs Areas/Identity/Pages/Account/Manage/_ManageNav.cshtml Areas/Identity/Pages/Account/Manage/ManageNavPages.cs
是否可以在不覆盖现有文件的情况下生成额外的文件?我不想丢失我已经进行的任何自定义设置。
此外,如果我使用 --force 只会覆盖错误中的 3 个文件,还是会覆盖我已经生成的所有文件??
每个文件名(例如Account.Manage.EnableAuthenticator
)包含几个文件,这些文件在identitygeneratorfilesconfig.json
模板中列出:
目前似乎会覆盖现有文件并且找不到禁用该行为的选项,您可以使用dotnet aspnet-codegenerator identity --listFiles
,它会显示需要使用--force
覆盖的现有文件。
Also, if I use --force will only the 3 files in the error get overwritten or will every file I already generated be overwritten??
它将覆盖这 3 个文件,您可以 copy/save 自定义部分代码,将该部分代码粘贴到新创建的文件中。