I am trying to modify the existing identity by generating identity pages. I am using Visual Studio for Mac 2022 with ASP.Net 6 MVC.
The tutorials for Windows say to add a new scaffolding and select ‘Identity’, but there doesn’t seem to be an option for Mac. Is this possible?
2
Answers
It seems the only way to do it purely on Mac is to use the Dotnet CLI.
The Microsoft documentation details this: https://learn.microsoft.com/en-us/aspnet/core/security/authentication/scaffold-identity?view=aspnetcore-7.0&tabs=netcore-cli
First you need to install the ASP.NET Core scaffolder:
dotnet tool install -g dotnet-aspnet-codegenerator
Then to scaffold all pages:
dotnet aspnet-codegenerator identity -dc MyApplication.DataContext
Or specific pages:
dotnet aspnet-codegenerator identity -dc MyApplication.DataContext --files "Account.Register;Account.Login"
It is a strange there isn't a non-CLI approach for Mac users yet.
So far the best workaround I have found is to spin up Visual Studio on a Windows machine, scaffold the page(s) you want to override, then go back to your Mac.
You’ll need source control. I used GitHub but any source control should do.
Then you can go back to working on your Mac.