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
ASP.NET Core MVC Web Application
dotnet new mvc
ASP.NET Core Razor Pages Web Application
dotnet new razor
Console Application
dotnet new console
Blazor Server Application
dotnet new blazorserver
ASP.NET Core Web API
dotnet new webapi
Worker Service
dotnet new worker
WPF (Windows Presentation Foundation) Application
dotnet new wpf
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.