简体   繁体   中英

How to add an Area to an ASP.NET MVC project using Visual Studio 2019 for Mac?

I'm going through a Udemy ASP.NET Core 3 MVC course, and I'm trying to add an Area to my project. I understand that on PC, this has been moved to 'New Scaffolded Item', where the Area option shows up, but on the Mac, this option is 'New Scaffolding', and 'Area' isn't an option.

So how do I add a new Area to my ASP.NET MVC project? Google has failed to return anything specifically for Mac.

I understand your need. In macOS, you haven't powerful tool like Visual Studio for Windows. You need use command line.

https://docs.microsoft.com/en-us/aspnet/core/security/authentication/scaffold-identity?view=aspnetcore-3.1&tabs=netcore-cli

You will belong to 1 of 2 cases: Has existing Identity database schema or not. In any case, you can use command line. Use something like this:

dotnet tool install -g dotnet-aspnet-codegenerator
dotnet aspnet-codegenerator identity --useDefaultUI
dotnet ef migrations add CreateIdentitySchema
dotnet ef database update
// ...

The fist: Install tool by

dotnet tool install -g dotnet-aspnet-codegenerator

the second, use it

dotnet aspnet-codegenerator identity --useDefaultUI

Other trick: You can create a new project in PC (even remote Windows server), generate everything you want, then push it to Git sever or copy these files manually in file system. Simple and pragmatic.

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