Published: December 07 2021

.NET - Create and Run a Simple 'Hello World' Web App

With the .NET CLI you can create a new project with the dotnet new <TEMPLATE> command, where the TEMPLATE is the type of application you want to create. To create a .NET Web App execute the command dotnet new web --name <NAME>, the NAME parameter sets the name of the .NET project and directory created, if omitted the name of the current directory is used.

The web template creates a simple Hello World .NET starter web application that contains some basic configuration and a single endpoint that returns the string "Hello World!" from the base path ("/").

Follow these steps to create a starter .NET web application named MyWebApp and open it in VS Code.

  1. Install the .NET SDK from https://dotnet.microsoft.com/download, includes the .NET runtime and CLI
  2. Run the command dotnet new web --name MyWebApp to create a new web app named MyWebApp
  3. Navigate into the web app directory with the command cd MyWebApp
  4. Start the .NET web app with the command dotnet run
  5. Open the web app in a browser using the URL from the command output (Now listening on: http://localhost:[PORT NUMBER])

For more info on the dotnet new command see https://docs.microsoft.com/dotnet/core/tools/dotnet-new.

 


Need Some .NET Help?

Search fiverr for freelance .NET developers.


Follow me for updates

On Twitter or RSS.


When I'm not coding...

Me and Tina are on a motorcycle adventure around Australia.
Come along for the ride!


Comments


Supported by