Create a new .NET MVC project starter (with the CLI)

DotNet starter project MVC generation using the command line interface.

.NET Core is a hugely popular web framework from Microsoft. You can use it to develop applications in F# and CSharp (or any CLR language) with built in support for many common operations. In this post we will show you how to scaffold a new .NET Core application using the CLI tools.

Install dotnet CLI

To begin with make sure you have the .NET SDK and dotnet cli installed.

Create a new project

Open a terminal and navigate to your project folder. Run the help command for dotnet new --list to see possible options

dotnet new --list
These templates matched your input:

    Template Name                                 Short Name      Language    Tags
--------------------------------------------  --------------  ----------  --------------------------
    ASP.NET Core Empty                            web             [C#],F#     Web/Empty
ASP.NET Core gRPC Service                     grpc            [C#]        Web/gRPC
ASP.NET Core Web API                          webapi          [C#],F#     Web/WebAPI
ASP.NET Core Web App                          webapp,razor    [C#]        Web/MVC/Razor Pages
ASP.NET Core Web App (Model-View-Controller)  mvc             [C#],F#     Web/MVC            

Choose a template type

We will create a new webapp which support HTML view rendering and MVC controllers.

 dotnet new webapp -o my-project
The template "ASP.NET Core Web App" was created successfully.
This template contains technologies from parties other than Microsoft, see https://aka.ms/aspnetcore/6.0-third-party-notices for details.

Processing post-creation actions...
Running 'dotnet restore' on /root/my-project/my-project.csproj...
  Determining projects to restore...
  Restored /root/my-project/my-project.csproj (in 60 ms).
Restore succeeded.

Creating tests using the CLI

We can create test packages for xUnit, MSTest and NUnit using the command line:

 dotnet new xunit -o test --name test
The template "xUnit Test Project" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on /root/ms2-sms-ingest/test/test.csproj...
  Determining projects to restore...
  Restored /root/ms2-sms-ingest/test/test.csproj (in 298 ms).
Restore succeeded.

Related content

CSharp Email API for DotNET and ASP

Receive email in DotNET Core using C# and MailSlurp

How to fix the any package by glob error in dotnet

Fix .NET installation on Linux for missing dotnet dependencies.

Disposable email accounts for DotNET core 6

Create real throw-away email addresses for testing and development in .NET core. Follow this guide to get started.

DotNET Core Cake Task Runner (CSharp Makefiles for coverlet ...

Create cross platform build scripts for DotNET Core in a way similar to Makefiles.

Create a new .NET MVC project starter (with the CLI)

DotNet starter project MVC generation using the command line interface.

Mailinator alternative

Alternatives to Mailinator for test email accounts. Create real email addresses using MailSlurp

Ready to dive in?Start building email applications today.