Getting started with .NET 6.x

Getting started with .NET 6.x

Photo by Clay Banks on Unsplash

Download and Install .NET 6.x

Go here to download the correct .NET 6.x SDK depending on your OS (Windows, macOS or Linux) and then install the same.

**Create a project and run **

Open a terminal window and run below command to verify the version.

sunilvijendra> dotnet --list-sdks
6.0.300 [/usr/local/share/dotnet/sdk]

Now running below command will show the project templates which can be used to create the project.

dotnet new --list

I chose 'webapp' which creates and basic ASP.NET Core WebApp. (Note: Use the short name in the following command.

And -o option is the output location and below command will create a directory named "helloworld" in the current directory and create all required files from the template.

dotnet new webapp -o helloworld

Now change to the newly created directory and run the app.

cd helloworld
dotnet run

The output will show the URL where the app is run.

dotnet run
Building...
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: https://localhost:7005
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:5111
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /Users/sunilvijendra/TechProjects/AzureBeckonsContainers/helloworld/

Now open a browser and check to see if the basic page is up and running (in the above case: localhost:5111). It should look like below:

sample-webapp.png

If you are seeing the above page, then pat you back! You just built your first .NET 6.0 WebApp!!