skip to Main Content

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


  1. Chosen as BEST ANSWER

    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.


  2. 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.

    1. On your Mac, push your app to GitHub.
    2. On the Windows machine, pull your app to Visual Studio.
    3. Still on the Windows machine, scaffold the identity page(s) you want, commit and push the changes back to GitHub.
    4. On your Mac, pull the app from GitHub.

    Then you can go back to working on your Mac.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search