How to set up a development environment for .NET on Ubuntu

Installing .NET

There are multiple methods for installing the .NET toolchain on Ubuntu:

  • Using the dotnet snap – a .NET toolchain installer that makes it easy to install the latest releases of .NET SDKs/runtimes in parallel.

  • Using Ubuntu packages from Ubuntu package feeds – official packages maintained by the Ubuntu team and installed through the Ubuntu package-management system.

  • Using Microsoft packages from the Microsoft package feed – official packages maintained by Microsoft and installed through the Ubuntu package-management system.

  • Using Microsoft’s installation script – a script you download and run in your terminal that allows you to install any .NET release.

  • Manual installation – download the release binaries as a tarball and install them manually.

Warning

It’s recommended to install the .NET toolchain from.Do not mix multiple installation methods, as this may lead to problems when applications try to resolve a specific version of .NET or when you try to update your installation to a new release.

Deciding how to install .NET

Tip

We recommend to use the dotnet snap as we created it specifically to make installing .NET on Ubuntu easy, but there are cases where this may not fit your needs.

With the many options available to install .NET on Ubuntu, it can seem overwhelming at first, which method to choose. Below you find an overview and more details for specific cases that should help you select an installation method:

        %%{init: {"flowchart": {"htmlLabels": false}} }%%
flowchart TD
    NeedNewerFeatureBands{{"`Do you need a higher<br>SDK feature band?<br>(higher than x.x.1xx)`"}}
    NeedPreviewsOrOlderVersions{{"`Do you need preview or older (unsupported) versions?`"}}
    WhichArch1{{"`What is the architecture of your system you want to install .NET on?`"}}
    WhichArch2{{"`What is the architecture of your system you want to install .NET on?`"}}
    WhichArch3{{"`What is the architecture of your system you want to install .NET on?`"}}
    NeedAPT{{"`Do you prefer to use APT?`"}}
    UsesAmd64JammyOrNewer{{"`Do you want to install .NET on Ubuntu 22.04 or newer?`"}}
    UsesArm64JammyOrNewer{{"`Do you want to install .NET on Ubuntu 22.04 or newer?`"}}
    UsesS390xOrPowerJammyOrNewer{{"`Do you want to install .NET on Ubuntu 22.04 or newer?`"}}
    
    UbuntuPackagesInstallation["`Use Ubuntu packages`"]
    SnapInstallation["`**Use the <c>dotnet</c> Snap**`"]
    MicrosoftPackagesInstallation1["`Use Microsoft packages`"]
    MicrosoftPackagesInstallation2["`Use Microsoft packages`"]
    MicrosoftScriptInstallation1["`Use the Microsoft<br>installer script`"]
    MicrosoftScriptInstallation2["`Use the Microsoft<br>installer script`"]
    MicrosoftScriptInstallation3["`Use the Microsoft<br>installer script`"]
    NoInstallation1["`Unfortunately there exists no supported installation method for this case`"]
    NoInstallation2["`Unfortunately there exists no supported installation method for this case`"]
    NoInstallation3["`Unfortunately there exists no supported installation method for this case`"]

    NeedNewerFeatureBands -- Yes --> WhichArch1
    NeedNewerFeatureBands -- No --> NeedPreviewsOrOlderVersions
    WhichArch1 -- x64 --> MicrosoftPackagesInstallation1
    WhichArch1 -- arm64 or arm32 --> MicrosoftScriptInstallation1
    WhichArch1 -- other --> NoInstallation1

    NeedPreviewsOrOlderVersions -- No ----> WhichArch3
    NeedPreviewsOrOlderVersions -- Yes --> WhichArch2
    WhichArch2 -- x64, arm64 or arm32 --> MicrosoftScriptInstallation2
    WhichArch2 -- other --> NoInstallation2
    

    WhichArch3 -- x64 --> UsesAmd64JammyOrNewer
    WhichArch3 -- arm64 --> UsesArm64JammyOrNewer
    WhichArch3 -- arm32 --> MicrosoftScriptInstallation3
    WhichArch3 -- s390x or ppc64el --> UsesS390xOrPowerJammyOrNewer
    WhichArch3 -- other --> NoInstallation3

    UsesAmd64JammyOrNewer -- No --> MicrosoftPackagesInstallation2
    UsesAmd64JammyOrNewer -- Yes --> NeedAPT

    UsesArm64JammyOrNewer -- Yes --> NeedAPT
    UsesArm64JammyOrNewer -- No --> MicrosoftScriptInstallation3

    UsesS390xOrPowerJammyOrNewer -- Yes --> UbuntuPackagesInstallation
    UsesS390xOrPowerJammyOrNewer -- No ---> NoInstallation3

    NeedAPT -- No --> SnapInstallation
    NeedAPT -- Yes --> UbuntuPackagesInstallation
    

Method

Pros

Cons

dotnet snap

  • easy & simple installation experience

  • currently only supports x64 and arm64 system architectures

  • currently only supports Ubuntu 22.04+

Ubuntu packages

  • supports IBM System Z and POWER system architectures for .NET 8+

  • some .NET versions are only available after installing an APT repository

  • by default, non-security updates are made available with a delay of 1+ week(s); APT can be configured to install them as soon as they are available

  • only supports Ubuntu 22.04+

Microsoft packages

  • supports Ubuntu 16.04, 18.04, 20.04

  • higher SDK feature bands are available (> x.x.1xx)

  • requires installing an APT repository

  • APT may needs to be configure to resolve conflicts with Ubuntu packages

  • no support for Ubuntu 24.04+¹

  • only supports the x64 system architecture

Microsoft’s scripted / manual installation

  • control where .NET is installed

  • preview releases are available

  • old (unsupported) versions of .NET are available

  • higher SDK feature bands are available (> x.x.1xx)

  • supports the arm32 system architecture

  • error-prone

  • updates need to be installed manually

  • dependencies have to be installed manually

  • no support for IBM System Z and POWER system architectures

¹ Clarification: Canonical maintains .NET packages since 2023. The maintainer team has asked Microsoft to discontinue their package feed for newer Ubuntu versions in favor of Canonical Ubuntu packages.


Installing .NET with the dotnet snap

Install the dotnet snap:

sudo snap install --classic --edge dotnet

Now you are effectively done. If you run the dotnet command without any .NET component installed, the snap automatically installs the latest .NET LTS SDK before proceeding with the invoked command.

Listing installed/available components and versions

To list components and versions that are installed or available for installation, run the following command in a terminal:

dotnet-installer list

Tip

By default, unsupported (end of life) versions are not listed. To list all available versions, add the --all flag.

Example output:

~$ dotnet-installer list
┌────────────┬────────────────────┬──────────────────────┬─────────────────────┬─────────────┐ Version    .NET Runtime       ASP.NET Core Runtime SDK                 End of Life ├────────────┼────────────────────┼──────────────────────┼─────────────────────┼─────────────┤ .NET 9     Available [9.0.2]  Available [9.0.2]    Available [9.0.103] 5/12/2026   .NET 8 LTS Installed [8.0.13] Installed [8.0.13]   Installed [8.0.113] 11/10/2026  └────────────┴────────────────────┴──────────────────────┴─────────────────────┴─────────────┘

Installing .NET components

To install a .NET component, run the following command:

dotnet-installer install [<component> [<versison>]]

Valid values for the <component> parameter are:

  • runtime: installs the .NET runtime (without the components needed to run ASP.NET Core apps)

  • aspnetcore-runtime: installs the ASP.NET Core runtime

  • sdk (default): installs the .NET SDK (including the .NET runtime with the components needed to run ASP.NET Core apps)

Valid values for the <version> parameter are:

  • lts: installs the latest .NET LTS release

  • latest (default): installs the latest .NET release

  • 9.0: installs .NET 9.0

  • 9: installs .NET 9.0

  • 8.0: installs .NET 8.0

  • 8: installs .NET 8.0

  • 6.0: installs .NET 6.0

  • 6: installs .NET 6.0

Examples:

  • To install the runtime of the latest .NET release, run:

    dotnet-installer install runtime latest
    
  • To install the SDK of the latest .NET LTS release, run:

    dotnet-installer install sdk lts
    
  • To install the .NET 8 ASP.NET Core runtime, run:

    dotnet-installer install aspnetcore-runtime 8
    
  • To install the .NET 9 SDK, run:

    dotnet-installer install sdk 9.0
    

Uninstalling .NET components

To install a .NET component, run the following command:

dotnet-installer remove <component> <versison>

The command works similar to the dotnet installer install command (documented above) – just uninstalling instead of installing. One difference to the syntax of the installation command is that the parameters <component> and <version> are required.

Uninstalling the dotnet snap

To remove the dotnet snap and all installed components, run:

snap remove dotnet

Installing .NET from Ubuntu packages

Choose your Ubuntu version:

Tip

You can see your Ubuntu versions by running the following command in a terminal:

lsb_release -rs

Choose the .NET version you want to install:

Available for architectures:

amd64 (aka x64), arm64, s390x (aka IBM System Z), ppc64el (aka POWER)

Installing proposed updates (optional)

Every .NET release that does not contain security fixes is only available with a delay of at least a week and sometimes much longer.

To install updates as soon as they are available, see the section Installing proposed .NET updates; otherwise you can skip this part.

Installing the SDK

The .NET SDK allows you to develop apps with .NET. To install the .NET SDK, run the following command:

sudo apt update && sudo apt install --install-suggests dotnet-sdk-9.0

Note

Additionally the package dotnet-sdk-aot-9.0 is installed as a recommended dependency. This package contains components to build your .NET application as native ahead-of-time compiled code. You can instruct APT to not install this package by adding the --no-install-recommends flag.

The flag --install-suggests instructs APT to install the suggested dependencies dotnet-sdk-dbg-9.0, aspnetcore-runtime-dbg-9.0 and dotnet-runtime-dbg-9.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install these packages.

Tip

There also exists a package with the name dotnet9. This is an alias for the dotnet-sdk-9.0 package.

Installing the runtime

Note

If you installed the .NET SDK, the corresponding runtime is installed automatically as a required dependency.

A .NET runtime allows you to run .NET apps that don’t provide a runtime. The following command installs the ASP.NET Core Runtime, which is the most compatible runtime for .NET:

sudo apt update && sudo apt install --install-suggests aspnetcore-runtime-9.0

Note

The flag --install-suggests instructs APT to install the suggested dependencies aspnetcore-runtime-dbg-9.0 and dotnet-runtime-dbg-9.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install these packages.

Alternatively, you can just install the .NET runtime without the ASP.NET Core components:

sudo apt update && sudo apt install --install-suggests dotnet-runtime-9.0

Note

The flag --install-suggests instructs APT to install the suggested dependency dotnet-runtime-dbg-9.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install this package.

Available for architectures:

amd64 (aka x64), arm64, s390x (aka IBM System Z), ppc64el (aka POWER)

Installing proposed updates (optional)

Every .NET release that does not contain security fixes is only available with a delay of at least a week and sometimes much longer.

To install updates as soon as they are available, see the section Installing proposed .NET updates; otherwise you can skip this part.

Installing the SDK

The .NET SDK allows you to develop apps with .NET. To install the .NET SDK, run the following command:

sudo apt update && sudo apt install --install-suggests dotnet-sdk-8.0

Note

The flag --install-suggests instructs APT to install the suggested dependencies dotnet-sdk-dbg-8.0, aspnetcore-runtime-dbg-8.0, and dotnet-runtime-dbg-8.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install these packages.

Tip

There also exists a package with the name dotnet8. This is an alias for the dotnet-sdk-8.0 package.

Installing the runtime

Note

If you installed the .NET SDK, the corresponding runtime is installed automatically as a required dependency.

A .NET runtime allows you to run .NET apps that don’t provide a runtime. The following command installs the ASP.NET Core Runtime, which is the most compatible runtime for .NET:

sudo apt update && sudo apt install --install-suggests aspnetcore-runtime-8.0

Note

The flag --install-suggests instructs APT to install the suggested dependencies aspnetcore-runtime-dbg-8.0 and dotnet-runtime-dbg-8.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install these packages.

Alternatively, you can just install the .NET runtime without the ASP.NET Core components:

sudo apt update && sudo apt install --install-suggests dotnet-runtime-8.0

Note

The flag --install-suggests instructs APT to install the suggested dependency dotnet-runtime-dbg-8.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install this package.

.NET 7 isn’t supported on 25.04 (Plucky Puffin).

.NET 6 isn’t supported on 25.04 (Plucky Puffin).

Choose the .NET version you want to install:

Available for architectures:

amd64 (aka x64), arm64, s390x (aka IBM System Z), ppc64el (aka POWER)

Installing proposed updates (optional)

Every .NET release that does not contain security fixes is only available with a delay of at least a week and sometimes much longer.

To install updates as soon as they are available, see the section Installing proposed .NET updates; otherwise you can skip this part.

Installing the SDK

The .NET SDK allows you to develop apps with .NET. To install the .NET SDK, run the following command:

sudo apt update && sudo apt install --install-suggests dotnet-sdk-9.0

Note

Additionally the package dotnet-sdk-aot-9.0 is installed as a recommended dependency. This package contains components to build your .NET application as native ahead-of-time compiled code. You can instruct APT to not install this package by adding the --no-install-recommends flag.

The flag --install-suggests instructs APT to install the suggested dependencies dotnet-sdk-dbg-9.0, aspnetcore-runtime-dbg-9.0 and dotnet-runtime-dbg-9.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install these packages.

Tip

There also exists a package with the name dotnet9. This is an alias for the dotnet-sdk-9.0 package.

Installing the runtime

Note

If you installed the .NET SDK, the corresponding runtime is installed automatically as a required dependency.

A .NET runtime allows you to run .NET apps that don’t provide a runtime. The following command installs the ASP.NET Core Runtime, which is the most compatible runtime for .NET:

sudo apt update && sudo apt install --install-suggests aspnetcore-runtime-9.0

Note

The flag --install-suggests instructs APT to install the suggested dependencies aspnetcore-runtime-dbg-9.0 and dotnet-runtime-dbg-9.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install these packages.

Alternatively, you can just install the .NET runtime without the ASP.NET Core components:

sudo apt update && sudo apt install --install-suggests dotnet-runtime-9.0

Note

The flag --install-suggests instructs APT to install the suggested dependency dotnet-runtime-dbg-9.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install this package.

Available for architectures:

amd64 (aka x64), arm64, s390x (aka IBM System Z), ppc64el (aka POWER)

Installing proposed updates (optional)

Every .NET release that does not contain security fixes is only available with a delay of at least a week and sometimes much longer.

To install updates as soon as they are available, see the section Installing proposed .NET updates; otherwise you can skip this part.

Installing the SDK

The .NET SDK allows you to develop apps with .NET. To install the .NET SDK, run the following command:

sudo apt update && sudo apt install --install-suggests dotnet-sdk-8.0

Note

The flag --install-suggests instructs APT to install the suggested dependencies dotnet-sdk-dbg-8.0, aspnetcore-runtime-dbg-8.0, and dotnet-runtime-dbg-8.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install these packages.

Tip

There also exists a package with the name dotnet8. This is an alias for the dotnet-sdk-8.0 package.

Installing the runtime

Note

If you installed the .NET SDK, the corresponding runtime is installed automatically as a required dependency.

A .NET runtime allows you to run .NET apps that don’t provide a runtime. The following command installs the ASP.NET Core Runtime, which is the most compatible runtime for .NET:

sudo apt update && sudo apt install --install-suggests aspnetcore-runtime-8.0

Note

The flag --install-suggests instructs APT to install the suggested dependencies aspnetcore-runtime-dbg-8.0 and dotnet-runtime-dbg-8.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install these packages.

Alternatively, you can just install the .NET runtime without the ASP.NET Core components:

sudo apt update && sudo apt install --install-suggests dotnet-runtime-8.0

Note

The flag --install-suggests instructs APT to install the suggested dependency dotnet-runtime-dbg-8.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install this package.

.NET 7 isn’t supported on 24.10 (Oracular Oriole).

.NET 6 isn’t supported on 24.10 (Oracular Oriole).

Choose the .NET version you want to install:

Available for architectures:

amd64 (aka x64), arm64, s390x (aka IBM System Z), ppc64el (aka POWER)

Registering the .NET backports PPA

This version of .NET is not available in the Ubuntu archive because Canonical is not committed to maintaining this version of .NET for the lifetime of this Ubuntu version. But Canonical maintains builds in the .NET backports PPA. The maintenance is on a best-effort basis and limited to the upstream lifetime of this .NET version: .NET Support Policy.

Add the .NET backports PPA as a source for APT:

sudo add-apt-repository ppa:dotnet/backports

If you later want to remove the .NET backports PPA, run the above command with the --remove flag.

Tip

add-apt-repository(1) is a command provided by the software-properties-common package. On most Ubuntu systems, this package is installed by default. If your system reports that the command add-apt-repository could not be found, install the software-properties-common package:

sudo apt update && sudo apt install software-properties-common

Installing the SDK

The .NET SDK allows you to develop apps with .NET. To install the .NET SDK, run the following command:

sudo apt update && sudo apt install --install-suggests dotnet-sdk-9.0

Note

Additionally the package dotnet-sdk-aot-9.0 is installed as a recommended dependency. This package contains components to build your .NET application as native ahead-of-time compiled code. You can instruct APT to not install this package by adding the --no-install-recommends flag.

The flag --install-suggests instructs APT to install the suggested dependencies dotnet-sdk-dbg-9.0, aspnetcore-runtime-dbg-9.0 and dotnet-runtime-dbg-9.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install these packages.

Tip

There also exists a package with the name dotnet9. This is an alias for the dotnet-sdk-9.0 package.

Installing the runtime

Note

If you installed the .NET SDK, the corresponding runtime is installed automatically as a required dependency.

A .NET runtime allows you to run .NET apps that don’t provide a runtime. The following command installs the ASP.NET Core Runtime, which is the most compatible runtime for .NET:

sudo apt update && sudo apt install --install-suggests aspnetcore-runtime-9.0

Note

The flag --install-suggests instructs APT to install the suggested dependencies aspnetcore-runtime-dbg-9.0 and dotnet-runtime-dbg-9.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install these packages.

Alternatively, you can just install the .NET runtime without the ASP.NET Core components:

sudo apt update && sudo apt install --install-suggests dotnet-runtime-9.0

Note

The flag --install-suggests instructs APT to install the suggested dependency dotnet-runtime-dbg-9.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install this package.

Available for architectures:

amd64 (aka x64), arm64, s390x (aka IBM System Z), ppc64el (aka POWER)

Installing proposed updates (optional)

Every .NET release that does not contain security fixes is only available with a delay of at least a week and sometimes much longer.

To install updates as soon as they are available, see the section Installing proposed .NET updates; otherwise you can skip this part.

Installing the SDK

The .NET SDK allows you to develop apps with .NET. To install the .NET SDK, run the following command:

sudo apt update && sudo apt install --install-suggests dotnet-sdk-8.0

Note

The flag --install-suggests instructs APT to install the suggested dependencies dotnet-sdk-dbg-8.0, aspnetcore-runtime-dbg-8.0, and dotnet-runtime-dbg-8.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install these packages.

Tip

There also exists a package with the name dotnet8. This is an alias for the dotnet-sdk-8.0 package.

Installing the runtime

Note

If you installed the .NET SDK, the corresponding runtime is installed automatically as a required dependency.

A .NET runtime allows you to run .NET apps that don’t provide a runtime. The following command installs the ASP.NET Core Runtime, which is the most compatible runtime for .NET:

sudo apt update && sudo apt install --install-suggests aspnetcore-runtime-8.0

Note

The flag --install-suggests instructs APT to install the suggested dependencies aspnetcore-runtime-dbg-8.0 and dotnet-runtime-dbg-8.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install these packages.

Alternatively, you can just install the .NET runtime without the ASP.NET Core components:

sudo apt update && sudo apt install --install-suggests dotnet-runtime-8.0

Note

The flag --install-suggests instructs APT to install the suggested dependency dotnet-runtime-dbg-8.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install this package.

Caution

This .NET version is no longer maintained.

Available for architectures:

amd64 (aka x64), arm64

Registering the .NET backports PPA

This version of .NET is not available in the Ubuntu archive because Canonical is not committed to maintaining this version of .NET for the lifetime of this Ubuntu version. But Canonical maintains builds in the .NET backports PPA. The maintenance is on a best-effort basis and limited to the upstream lifetime of this .NET version: .NET Support Policy.

Add the .NET backports PPA as a source for APT:

sudo add-apt-repository ppa:dotnet/backports

If you later want to remove the .NET backports PPA, run the above command with the --remove flag.

Tip

add-apt-repository(1) is a command provided by the software-properties-common package. On most Ubuntu systems, this package is installed by default. If your system reports that the command add-apt-repository could not be found, install the software-properties-common package:

sudo apt update && sudo apt install software-properties-common

Installing the SDK

The .NET SDK allows you to develop apps with .NET. To install the .NET SDK, run the following command:

sudo apt update && sudo apt install dotnet-sdk-7.0

Tip

There also exists a package with the name dotnet7. This is an alias for the dotnet-sdk-7.0 package.

Installing the runtime

Note

If you installed the .NET SDK, the corresponding runtime is installed automatically as a required dependency.

A .NET runtime allows you to run .NET apps that don’t provide a runtime. The following command installs the ASP.NET Core Runtime, which is the most compatible runtime for .NET:

sudo apt update && sudo apt install aspnetcore-runtime-7.0

Alternatively, you can just install the .NET runtime without the ASP.NET Core components:

sudo apt update && sudo apt install dotnet-runtime-7.0

Caution

This .NET version is no longer maintained.

Available for architectures:

amd64 (aka x64), arm64

Registering the .NET backports PPA

This version of .NET is not available in the Ubuntu archive because Canonical is not committed to maintaining this version of .NET for the lifetime of this Ubuntu version. But Canonical maintains builds in the .NET backports PPA. The maintenance is on a best-effort basis and limited to the upstream lifetime of this .NET version: .NET Support Policy.

Add the .NET backports PPA as a source for APT:

sudo add-apt-repository ppa:dotnet/backports

If you later want to remove the .NET backports PPA, run the above command with the --remove flag.

Tip

add-apt-repository(1) is a command provided by the software-properties-common package. On most Ubuntu systems, this package is installed by default. If your system reports that the command add-apt-repository could not be found, install the software-properties-common package:

sudo apt update && sudo apt install software-properties-common

Installing the SDK

The .NET SDK allows you to develop apps with .NET. To install the .NET SDK, run the following command:

sudo apt update && sudo apt install dotnet-sdk-6.0

Tip

There also exists a package with the name dotnet6. This is an alias for the dotnet-sdk-6.0 package.

Installing the runtime

Note

If you installed the .NET SDK, the corresponding runtime is installed automatically as a required dependency.

A .NET runtime allows you to run .NET apps that don’t provide a runtime. The following command installs the ASP.NET Core Runtime, which is the most compatible runtime for .NET:

sudo apt update && sudo apt install aspnetcore-runtime-6.0

Alternatively, you can just install the .NET runtime without the ASP.NET Core components:

sudo apt update && sudo apt install dotnet-runtime-6.0

Choose the .NET version you want to install:

Available for architectures:

amd64 (aka x64), arm64, s390x (aka IBM System Z), ppc64el (aka POWER)

Registering the .NET backports PPA

This version of .NET is not available in the Ubuntu archive because Canonical is not committed to maintaining this version of .NET for the lifetime of this Ubuntu version. But Canonical maintains builds in the .NET backports PPA. The maintenance is on a best-effort basis and limited to the upstream lifetime of this .NET version: .NET Support Policy.

Add the .NET backports PPA as a source for APT:

sudo add-apt-repository ppa:dotnet/backports

If you later want to remove the .NET backports PPA, run the above command with the --remove flag.

Tip

add-apt-repository(1) is a command provided by the software-properties-common package. On most Ubuntu systems, this package is installed by default. If your system reports that the command add-apt-repository could not be found, install the software-properties-common package:

sudo apt update && sudo apt install software-properties-common

Installing the SDK

The .NET SDK allows you to develop apps with .NET. To install the .NET SDK, run the following command:

sudo apt update && sudo apt install --install-suggests dotnet-sdk-9.0

Note

Additionally the package dotnet-sdk-aot-9.0 is installed as a recommended dependency. This package contains components to build your .NET application as native ahead-of-time compiled code. You can instruct APT to not install this package by adding the --no-install-recommends flag.

The flag --install-suggests instructs APT to install the suggested dependencies dotnet-sdk-dbg-9.0, aspnetcore-runtime-dbg-9.0 and dotnet-runtime-dbg-9.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install these packages.

Tip

There also exists a package with the name dotnet9. This is an alias for the dotnet-sdk-9.0 package.

Installing the runtime

Note

If you installed the .NET SDK, the corresponding runtime is installed automatically as a required dependency.

A .NET runtime allows you to run .NET apps that don’t provide a runtime. The following command installs the ASP.NET Core Runtime, which is the most compatible runtime for .NET:

sudo apt update && sudo apt install --install-suggests aspnetcore-runtime-9.0

Note

The flag --install-suggests instructs APT to install the suggested dependencies aspnetcore-runtime-dbg-9.0 and dotnet-runtime-dbg-9.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install these packages.

Alternatively, you can just install the .NET runtime without the ASP.NET Core components:

sudo apt update && sudo apt install --install-suggests dotnet-runtime-9.0

Note

The flag --install-suggests instructs APT to install the suggested dependency dotnet-runtime-dbg-9.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install this package.

Available for architectures:

amd64 (aka x64), arm64, s390x (aka IBM System Z), ppc64el (aka POWER)

Installing proposed updates (optional)

Every .NET release that does not contain security fixes is only available with a delay of at least a week and sometimes much longer.

To install updates as soon as they are available, see the section Installing proposed .NET updates; otherwise you can skip this part.

Installing the SDK

The .NET SDK allows you to develop apps with .NET. To install the .NET SDK, run the following command:

sudo apt update && sudo apt install --install-suggests dotnet-sdk-8.0

Note

The flag --install-suggests instructs APT to install the suggested dependencies dotnet-sdk-dbg-8.0, aspnetcore-runtime-dbg-8.0, and dotnet-runtime-dbg-8.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install these packages.

Tip

There also exists a package with the name dotnet8. This is an alias for the dotnet-sdk-8.0 package.

Installing the runtime

Note

If you installed the .NET SDK, the corresponding runtime is installed automatically as a required dependency.

A .NET runtime allows you to run .NET apps that don’t provide a runtime. The following command installs the ASP.NET Core Runtime, which is the most compatible runtime for .NET:

sudo apt update && sudo apt install --install-suggests aspnetcore-runtime-8.0

Note

The flag --install-suggests instructs APT to install the suggested dependencies aspnetcore-runtime-dbg-8.0 and dotnet-runtime-dbg-8.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install these packages.

Alternatively, you can just install the .NET runtime without the ASP.NET Core components:

sudo apt update && sudo apt install --install-suggests dotnet-runtime-8.0

Note

The flag --install-suggests instructs APT to install the suggested dependency dotnet-runtime-dbg-8.0. These packages provide PDB debug symbols. Remove this flag if you do not want to install this package.

Available for architectures:

amd64 (aka x64), arm64

Installing proposed updates (optional)

Every .NET release that does not contain security fixes is only available with a delay of at least a week and sometimes much longer.

To install updates as soon as they are available, see the section Installing proposed .NET updates; otherwise you can skip this part.

Installing the SDK

The .NET SDK allows you to develop apps with .NET. To install the .NET SDK, run the following command:

sudo apt update && sudo apt install dotnet-sdk-7.0

Tip

There also exists a package with the name dotnet7. This is an alias for the dotnet-sdk-7.0 package.

Installing the runtime

Note

If you installed the .NET SDK, the corresponding runtime is installed automatically as a required dependency.

A .NET runtime allows you to run .NET apps that don’t provide a runtime. The following command installs the ASP.NET Core Runtime, which is the most compatible runtime for .NET:

sudo apt update && sudo apt install aspnetcore-runtime-7.0

Alternatively, you can just install the .NET runtime without the ASP.NET Core components:

sudo apt update && sudo apt install dotnet-runtime-7.0
Available for architectures:

amd64 (aka x64), arm64

Installing proposed updates (optional)

Every .NET release that does not contain security fixes is only available with a delay of at least a week and sometimes much longer.

To install updates as soon as they are available, see the section Installing proposed .NET updates; otherwise you can skip this part.

Installing the SDK

The .NET SDK allows you to develop apps with .NET. To install the .NET SDK, run the following command:

sudo apt update && sudo apt install dotnet-sdk-6.0

Tip

There also exists a package with the name dotnet6. This is an alias for the dotnet-sdk-6.0 package.

Installing the runtime

Note

If you installed the .NET SDK, the corresponding runtime is installed automatically as a required dependency.

A .NET runtime allows you to run .NET apps that don’t provide a runtime. The following command installs the ASP.NET Core Runtime, which is the most compatible runtime for .NET:

sudo apt update && sudo apt install aspnetcore-runtime-6.0

Alternatively, you can just install the .NET runtime without the ASP.NET Core components:

sudo apt update && sudo apt install dotnet-runtime-6.0

Installing proposed .NET updates

This section shows how to install proposed updates for Ubuntu .NET packages from the Ubuntu archive.

Motivation

Every .NET release that does not contain security fixes has to follow the Ubuntu stable release update (SRU) process. This process delays the deployment of .NET releases by at least a week and sometimes much longer (depending on the backlog of the SRU reviewers).

If you want to install new .NET releases as soon as they are available, you can configure APT to install the proposed updates to skip this delay.

Note

Canonical is collaborating with Microsoft and other .NET partners..NET releases are thoroughly tested before they are uploaded to the Ubuntu archive. Historically, no significant regressions were reported for .NET proposed updates. Therefore, the risk of installing proposed updates for .NET can be considered minimal or at least insignificantly small compared to waiting for the SRU completion.

Adding the Ubuntu proposed updates APT repository

First add the Ubuntu proposed updates APT repository as a source for APT to install updates from.

If the file /etc/apt/sources.list.d/ubuntu.sources exists on your system, add <release>-proposed to the Suites: line. For example:

Types: deb
URIs: http://archive.ubuntu.com/ubuntu
Suites: noble noble-updates noble-backports noble-proposed
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

Otherwise, modify the software sources manually by adding the proposed archive to your APT sources:

  • for amd64 (aka x64) systems:

    sudo tee /etc/apt/sources.list.d/ubuntu-$(lsb_release -cs)-proposed.list >/dev/null <<EOF
    # Enable Ubuntu proposed archive
    deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-proposed restricted main multiverse universe
    EOF
    
  • for arm64, s390x (aka IBM System Z) or ppc64el (aka POWER) systems

    sudo tee /etc/apt/sources.list.d/ubuntu-$(lsb_release -cs)-proposed.list >/dev/null <<EOF
    # Enable Ubuntu proposed archive
    deb http://ports.ubuntu.com/ubuntu-ports $(lsb_release -cs)-proposed restricted main multiverse universe
    EOF
    

Now update APT to fetch the package index from the added archive:

sudo apt update

Important

If using Ubuntu 22.04 or lower, configure APT to not install proposed updates by default. This is already the default since Ubuntu 24.04. Otherwise APT installs proposed updates for all packages.

sudo tee /etc/apt/preferences.d/proposed-updates >/dev/null <<EOF
# Configure apt to allow selective installs of packages from proposed
Package: *
Pin: release a=$(lsb_release -cs)-proposed
Pin-Priority: 400
EOF
Configuring APT to install proposed .NET updates

Finally, configure APT to consider .NET packages from the proposed archive for installation:

sudo tee /etc/apt/preferences.d/dotnet-proposed-updates >/dev/null <<EOF
# Configure apt to install dotnet packages from proposed
Package: src:dotnet*
Pin: release a=$(lsb_release -cs)-proposed
Pin-Priority: 500
EOF
Disabling installation of proposed updates

To stop the package management system from installing proposed .NET updates:

  1. Delete the configuration you created.

  2. Update the APT package index:

    sudo apt update
    

Note

Already installed proposed updates remain installed. To remove them, uninstall and re-install the affected packages.

Installing .NET from Microsoft packages

For this installation method, see Microsoft’s documentation: Install .NET SDK or .NET Runtime on Ubuntu.

Installing .NET with the Microsoft installation script

For this installation method, see Microsoft’s documentation: Install .NET on Linux by using an install script or by extracting binaries.

Installing .NET manually

For this installation method, see Microsoft’s documentation: Manual install.

Checking installed versions and components

To display installed .NET SDKs, runtimes, and other useful information, run the following command:

dotnet --info

To list installed .NET SDKs, run the following command:

dotnet --list-sdks

To list installed .NET runtimes, run the following command:

dotnet --list-runtimes

Example output:

~$ dotnet --info
.NET SDK: Version:           8.0.113 Commit:            67977f6ab7 Workload version:  8.0.100-manifests.bbbf61fd Runtime Environment: OS Name:     ubuntu OS Version:  24.04 OS Platform: Linux RID:         ubuntu.22.04-x64 Base Path:   /var/snap/dotnet/common/dotnet/sdk/8.0.113/ .NET workloads installed: Workload version: 8.0.100-manifests.bbbf61fdThere are no installed workloads to display. Host:  Version:      9.0.1  Architecture: x64  Commit:       1cf154a56d .NET SDKs installed:  8.0.113 [/var/snap/dotnet/common/dotnet/sdk] .NET runtimes installed:  Microsoft.AspNetCore.App 8.0.13 [/var/snap/dotnet/common/dotnet/shared/Microsoft.AspNetCore.App]  Microsoft.NETCore.App 8.0.13 [/var/snap/dotnet/common/dotnet/shared/Microsoft.NETCore.App] Other architectures found:  None Environment variables:  Not set global.json file:  Not found Learn more:  https://aka.ms/dotnet/info Download .NET:  https://aka.ms/dotnet/download
~$ dotnet --list-sdks
8.0.113 [/var/snap/dotnet/common/dotnet/sdk]
~$ dotnet --list-runtimes
Microsoft.AspNetCore.App 8.0.13 [/var/snap/dotnet/common/dotnet/shared/Microsoft.AspNetCore.App]Microsoft.NETCore.App 8.0.13 [/var/snap/dotnet/common/dotnet/shared/Microsoft.NETCore.App]

Setting up a .NET IDE

Many editors and IDEs (Integrated Development Environment) come with various degrees of support for .NET workloads. Here are some popular ones:

JetBrains Rider

JetBrains Rider currently offers the best developer experience for .NET projects on Linux. It integrates extensive debugging and profiling tools. It is free for non-commercial use.

To install JetBrains Rider, run the following command:

sudo snap install rider --classic

Visual Studio Code

The following popular .NET extensions are available for VS Code:

Extension

Description

Terms

C#:

Base language support for C#

free

C# Dev Kit

Extended language support and builds on top of the “C#” extension

  • free for individuals, academia, and open-source development

  • paid for organizations

see details

Ionide for F#

F# language support

free

To install VS Code run the following command:

sudo snap install code --classic

VS Codium

The following popular .NET extensions are available for VS Codium:

Extension

Description

Terms

C#:

Base language support for C#

(fork of the Microsoft extension that replaces the proprietary debugger with Samsung’s FOSS .NET debugger)

free

Ionide for F#

F# language support

free

To install VS Codium, run the following command:

sudo snap install codium --classic

What next

See the tutorial introducing the use of .NET and related tooling: Develop with .NET on Ubuntu.