ASP.NET CORE MVC - Development Environment
Development Environment
Prepare an Xubuntu virtual machine based on Ubuntu 20.04.3 LTS, install the .NET 8 SDK from Microsoft's package repository, configure Visual Studio Code and C# development tools, and learn the terminal commands used throughout this ASP.NET Core MVC tutorial series.
By the end of this tutorial, your computer will be ready for developing ASP.NET Core MVC applications using .NET 8, C# and Visual Studio Code.
- Understand ASP.NET Core
- Understand .NET, C# and MVC
- Review the technology stack
- Identify the Ubuntu version and computer architecture
- Register Microsoft's package repository
- Install and verify the .NET 8 SDK
- Explore the .NET command-line interface
- Install Visual Studio Code
- Install C# development tools
- Create the course working directory
- Verify the environment
1. What Is ASP.NET Core?
ASP.NET Core is Microsoft's cross-platform framework for developing modern web applications and web APIs using .NET.
ASP.NET Core applications can run on Linux, Windows and macOS.
In this tutorial series, we will use ASP.NET Core MVC to develop a Product Management System.
ASP.NET Core is not a programming language. We will mainly write the application using C#.
2. .NET, C# and ASP.NET Core
| Technology | Purpose |
|---|---|
| .NET | The development platform and runtime. |
| C# | The programming language used throughout this series. |
| ASP.NET Core | The .NET framework for web development. |
| ASP.NET Core MVC | An ASP.NET Core architecture based on Model-View-Controller. |
3. What Is MVC?
MVC stands for Model-View-Controller.
4. MVC versus Razor Pages
| ASP.NET Core MVC | Razor Pages |
|---|---|
| Uses separate controllers and views. | Organises application behaviour around pages. |
| Explicitly demonstrates the MVC pattern. | Can require fewer files for simple page-based applications. |
| Well suited for learning controller-based architecture. | Well suited for page-focused applications. |
5. Technology Stack
| Technology | Purpose |
|---|---|
| .NET 8 | Application development platform. |
| ASP.NET Core MVC | Web application framework. |
| C# | Programming language. |
| Visual Studio Code | Code editor. |
| C# Dev Kit | C# development support in VS Code. |
| Entity Framework Core | Database access later in the series. |
| SQLite | Application database. |
| Ubuntu/Linux Terminal | Run development commands. |
The examples in this series target .NET 8. The commands in this Part 0 note match the confirmed virtual machine environment: Xubuntu based on Ubuntu 20.04.3 LTS (focal), username xubuntu, and x64/amd64 architecture.
6. Install the .NET 8 SDK
Step 1: Identify the Ubuntu release
Xubuntu is an Ubuntu flavour, so its package availability depends on the underlying Ubuntu release. Check it before choosing an installation method:
lsb_release -a
On the virtual machine used for this series, the important output is:
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal
The message No LSB modules are available may appear above the result. It does not prevent the command from reporting the Ubuntu release.
Step 2: Confirm the architecture
dpkg --print-architecture
The virtual machine used here reports:
amd64
This means it uses the x64 architecture supported by Microsoft's Ubuntu package repository.
Step 3: Understand the initial installation error
Installing directly from the original Ubuntu 20.04 package sources produces this error:
E: Unable to locate package dotnet-sdk-8.0
E: Couldn't find any package by glob 'dotnet-sdk-8.0'
E: Couldn't find any package by regex 'dotnet-sdk-8.0'
For this Ubuntu 20.04 environment, enabling universe is not sufficient. The .NET 8 package must be obtained from Microsoft's Ubuntu 20.04 package repository.
Step 4: Register Microsoft's Ubuntu 20.04 repository
Return to the home directory:
cd ~
Download Microsoft's repository configuration package:
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb \
-O packages-microsoft-prod.deb
Register the repository:
sudo dpkg -i packages-microsoft-prod.deb
Remove the downloaded configuration file because it is no longer needed:
rm packages-microsoft-prod.deb
Refresh the package index. The output should now mention packages.microsoft.com/ubuntu/20.04/prod:
sudo apt-get update
Step 5: Install the SDK
sudo apt-get install -y dotnet-sdk-8.0
The SDK installation also installs the .NET runtime, ASP.NET Core runtime, targeting packs and other required development components.
Step 6: Verify the successful installation
dotnet --version
dotnet --info
The confirmed SDK version in this environment is:
8.0.424
The important values from dotnet --info are:
.NET SDK:
Version: 8.0.424
Runtime Environment:
OS Name: ubuntu
OS Version: 20.04
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/8.0.424/
.NET SDKs installed:
8.0.424 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.30
Microsoft.NETCore.App 8.0.30
Ubuntu 20.04 is now outside standard Ubuntu support. These commands document the confirmed working course VM, but a new long-term development environment should preferably use a currently supported Xubuntu LTS release such as Xubuntu 24.04.
7. Examine the .NET Installation
dotnet --info
dotnet --list-sdks
dotnet --list-runtimes
8. The dotnet Command
dotnet --help
Later in the series:
dotnet new
dotnet run
dotnet build
dotnet restore
dotnet add package
dotnet test
dotnet publish
9. Explore .NET Templates
dotnet new list
Look for the MVC template short name:
mvc
We will create the Product Management System in Part 1.
10. Install Visual Studio Code
The Snap Store connection on this VM returned a context canceled error. Install the official x64 Debian package instead.
Return to the home directory:
cd ~
Download the latest stable x64 package:
wget "https://update.code.visualstudio.com/latest/linux-deb-x64/stable" \
-O code_amd64.deb
Install Visual Studio Code:
sudo apt install -y ./code_amd64.deb
Remove the downloaded installer:
rm code_amd64.deb
Verify and start Visual Studio Code:
code --version
code
If the package manager reports missing dependencies, run sudo apt-get install -f, and then repeat the installation command.
11. Visual Studio Code Interface
12. Install C# Dev Kit
- Open Visual Studio Code.
- Open Extensions.
- Search for C# Dev Kit.
- Select the extension published by Microsoft.
- Click Install.
13. Create the Course Working Directory
cd ~
mkdir aspnet-mvc-tutorial
cd aspnet-mvc-tutorial
pwd
14. Open the Directory in Visual Studio Code
code .
The dot means the current directory.
15. Linux Path Concepts
| Symbol or Command | Meaning |
|---|---|
~ | Home directory. |
. | Current directory. |
.. | Parent directory. |
pwd | Display the current path. |
ls | List directory contents. |
cd | Change directory. |
mkdir | Create a directory. |
16. Verify the Development Environment
dotnet --version
dotnet --info
dotnet --list-sdks
dotnet new list
code --version
cd ~/aspnet-mvc-tutorial
code .
If the commands work successfully and C# Dev Kit is installed, your development environment is ready.
17. Hands-On Exercise
- Display your current directory.
- Display the installed .NET SDK version.
- Display detailed .NET information.
- List installed SDKs.
- Return to your home directory.
- Create a directory called
mvc-practice. - Enter the directory.
- Display its full path.
- Open it in Visual Studio Code.
pwd
dotnet --version
dotnet --info
dotnet --list-sdks
cd ~
mkdir mvc-practice
cd mvc-practice
pwd
code .
18. Knowledge Check
- What is ASP.NET Core?
- What programming language will be used in this tutorial?
- What does MVC stand for?
- What is the purpose of a controller?
- Which command displays the installed .NET SDK version?
- What does
pwddo? - What does
mkdirdo? - What does the dot mean in
code .? - Which Visual Studio Code extension provides C# development support?
- What repository is required to install .NET 8 on this Ubuntu 20.04 VM?
Show answers
- ASP.NET Core is a cross-platform .NET framework for building web applications and APIs.
- C#.
- Model-View-Controller.
- It handles requests and coordinates application responses.
dotnet --version.- It displays the current working directory.
- It creates a directory.
- It represents the current directory.
- C# Dev Kit.
- On this Ubuntu 20.04 VM, register Microsoft's Ubuntu 20.04 package repository, refresh the package index, and retry the installation.
19. Part 0 Summary
- Learned the relationship between C#, .NET and ASP.NET Core.
- Reviewed the MVC pattern.
- Identified the confirmed environment as Ubuntu 20.04.3 LTS on amd64.
- Registered Microsoft's Ubuntu 20.04 package repository.
- Installed and verified .NET SDK 8.0.424.
- Learned how to resolve the
Unable to locate package dotnet-sdk-8.0error. - Explored the .NET CLI.
- Installed Visual Studio Code.
- Installed C# Dev Kit.
- Created a working directory.
- Verified the development environment.
In Part 1, we will create the Product Management System using dotnet new mvc, examine the generated project structure, understand Program.cs, and run the application for the first time.