简体   繁体   中英

How can I generate identity pages on Visual Studio for Mac 2022?

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?

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.

It seems the only way to do it purely on Mac is to use the Do.net CLI.

The Microsoft documentation details this: https://learn.microsoft.com/en-us/as.net/core/security/authentication/scaffold-identity?view=as.netcore-7.0&tabs.netcore-cli

First you need to install the ASP.NET Core scaffolder:

do.net tool install -g do.net-as.net-codegenerator

Then to scaffold all pages:

do.net as.net-codegenerator identity -dc MyApplication.DataContext

Or specific pages:

do.net as.net-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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM