ASP.NET CORE - 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, and configure Visual Studio Code and C# development tools for ASP.NET Core development.
By the end of this tutorial, your computer will be ready for developing ASP.NET Core applications using .NET 8, C# and Visual Studio Code.
- Understand ASP.NET Core
- Understand the relationship between .NET, C# and ASP.NET Core
- 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
- Install Firefox
- 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.
ASP.NET Core supports several types of web projects, including browser-based applications, web APIs and real-time services. The development environment prepared here can be used with any of these approaches.
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. |
3. Technology Stack
| Technology | Purpose |
|---|---|
| .NET 8 | Application development platform. |
| ASP.NET Core | Cross-platform web application framework. |
| C# | Programming language. |
| Visual Studio Code | Code editor. |
| C# Dev Kit | C# development support in VS Code. |
| Firefox | Web browser for running and testing ASP.NET Core applications. |
| 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.
4. 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.
5. Examine the .NET Installation
dotnet --info
dotnet --list-sdks
dotnet --list-runtimes
6. The dotnet Command
dotnet --help
Later in the series:
dotnet new
dotnet run
dotnet build
dotnet restore
dotnet add package
dotnet test
dotnet publish
7. Explore .NET Templates
dotnet new list
The list contains templates for different kinds of .NET and ASP.NET Core projects. Each template has a name, short name, language and tags.
We will select and create the first ASP.NET Core project in Part 1.
8. 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.
9. Visual Studio Code Interface
10. Install C# Dev Kit
- Open Visual Studio Code.
- Open Extensions.
- Search for C# Dev Kit.
- Select the extension published by Microsoft.
- Click Install.
11. Create the Course Working Directory
cd ~
mkdir aspnet-core-tutorial
cd aspnet-core-tutorial
pwd
12. Open the Directory in Visual Studio Code
code .
The dot means the current directory.
13. Install Firefox
Firefox will be used to open and test ASP.NET Core applications in the virtual machine.
sudo apt update
sudo apt install -y firefox
Verify the installation:
firefox --version
Start Firefox from the terminal:
firefox
14. 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. |
15. Verify the Development Environment
dotnet --version
dotnet --info
dotnet --list-sdks
dotnet new list
code --version
firefox --version
cd ~/aspnet-core-tutorial
code .
If the commands work successfully and C# Dev Kit is installed, your development environment is ready.
16. 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
aspnet-practice. - Enter the directory.
- Display its full path.
- Open it in Visual Studio Code.
pwd
dotnet --version
dotnet --info
dotnet --list-sdks
cd ~
mkdir aspnet-practice
cd aspnet-practice
pwd
code .
17. Knowledge Check
- What is ASP.NET Core?
- What programming language will be used in this tutorial?
- 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?
- Which command installs Firefox using APT?
- 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#.
dotnet --version.- It displays the current working directory.
- It creates a directory.
- It represents the current directory.
- C# Dev Kit.
sudo apt install -y firefox.- On this Ubuntu 20.04 VM, register Microsoft's Ubuntu 20.04 package repository, refresh the package index, and retry the installation.
18. Part 0 Summary
- Learned the relationship between C#, .NET and ASP.NET Core.
- 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.
- Installed Firefox for testing ASP.NET Core applications.
- Verified the development environment.
In Part 1, we will select an appropriate ASP.NET Core project template, create the application, examine its generated structure, understand Program.cs, and run it for the first time.