Building a .NET MVC Application on Ubuntu 22.04: A Step-by-Step Guide

Building a .NET MVC Application on Ubuntu 22.04: A Step-by-Step Guide

in this, you will Learn how to build a .NET MVC application on Ubuntu 22.04 with this comprehensive step-by-step guide. From installation to running your app,

Install .net SDK and runtime

If you install the .NET SDK, you don't need to install the corresponding runtime

sudo apt-get update && \
  sudo apt-get install -y dotnet-sdk-8.0

Verify the installation

dotnet --list-sdks
dotnet --list-runtimes

Create a new MVC Application

dotnet new mvc -o Mvcapp

then move inside the project directory

 cd Mvcapp/

Run the Application

Run the following command to start your application with dotnet watch and configure it to listen on 0.0.0.0 o port 5000, this is beneficial if you are running an application inside VM, or docker.

 dotnet watch run --urls "http://0.0.0.0:5000"

Access the Application

Other Types of Applications we can create with .NET

These are the various templates provided by .NET

  1. ASP.NET Core MVC Web Application

    dotnet new mvc

  2. ASP.NET Core Razor Pages Web Application

    dotnet new razor

  3. Console Application

    dotnet new console

  4. Blazor Server Application

    dotnet new blazorserver

  5. ASP.NET Core Web API

    dotnet new webapi

  6. Worker Service

    dotnet new worker

  7. WPF (Windows Presentation Foundation) Application

    dotnet new wpf

  8. Azure Functions

    dotnet new azure-functions

Next, we will see how we can run the existing application in Ubuntu with an SQL server using Docker.

Did you find this article valuable?

Support Muhammad Usama by becoming a sponsor. Any amount is appreciated!