Add area in Asp.net MVC in vs code or .net cli

Viewed 45

We could easily create Aria with graphical user interface in VS, but it seems impossible in VS Code and Terminal.

1 Answers

From your description, I assume your application is an Asp.net core (asp.net 5/6/7) application, right?

If that is the case, you can open the MVC application using VS code and open a Terminal, then, use the following command to install the dotnet-aspnet-codegenerator tool and Microsoft.VisualStudio.Web.CodeGeneration.Design package:

dotnet tool install -g dotnet-aspnet-codegenerator
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design --version 6.0.8

After that, use the following code to add the Area:

dotnet-aspnet-codegenerator area AreaNameToGenerate

The screenshot as below:

enter image description here

More detail information about the area code generate command, see Area options.

Related