Skip to content

Latest commit

 

History

History
252 lines (189 loc) · 16.8 KB

Readme.md

File metadata and controls

252 lines (189 loc) · 16.8 KB

logo Raspberry Pi OS .NET APT Package Repository

.NET latest version Raspberry Pi OS latest version GitHub Actions

This public APT repository supplies armhf and arm64 .deb packages of .NET runtimes and SDKs to install on Raspberry Pis running Raspberry Pi OS/Raspbian.

Vendors like Microsoft, Red Hat, and Ubuntu provide official .deb packages for .NET, but none of them support armhf, so they can't be installed on Raspberry Pi OS with the default 32-bit architecture. Microsoft recommends installing .NET on Raspberry Pis using their build-machine–oriented installation script, which neither installs system-wide without extra manual steps, nor automatically updates or cleans up previous versions, nor lets you install the latest minor version without you manually looking up whether STS or LTS is currently newer.

This repository comprises unofficial packages that install official .NET Linux ARM releases built by Microsoft, created from the exact same Linux ARM binary archives that the official .NET download pages, release notes, and installation script link to.

Installation

Add APT repository

You only have to do this step once per Raspberry Pi OS installation.

sudo wget -q https://raspbian.aldaviva.com/aldaviva.gpg.key -O /etc/apt/trusted.gpg.d/aldaviva.gpg
echo "deb https://raspbian.aldaviva.com/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/aldaviva.list > /dev/null
sudo apt update

The OpenPGP key fingerprint is B3BF3504BBD0A81DD82A8DFB45D66F054AB9A66A. You can verify this with

gpg --show-keys /etc/apt/trusted.gpg.d/aldaviva.gpg

Install package

First, to install a package, choose the package name you want. The name is the concatenation of a name prefix and a versioning suffix. For example, if you want the latest version of the .NET Runtime, the package name would be dotnet-runtime-latest, which you could install by running

sudo apt install dotnet-runtime-latest

See the following sections for explanations all the package name possibilities.

Package name format
dotnet-runtime-latest
↗️
package type
↖️
version spec
  • dotnet-runtime-
  • aspnetcore-runtime-
  • dotnet-sdk-
  • latest
  • latest-lts
  • 8.0
  • 7.0
  • 6.0

There are three package type prefixes to choose from:

  • dotnet-runtime- for running command-line applications
  • aspnetcore-runtime- for running web applications
  • dotnet-sdk- for building applications

There are also three types of version specification suffixes to choose from, which control the versions that the package should install and allow upgrades to.

  • latest installs the LTS or STS release with the greatest version number
  • latest-lts installs the LTS release with the greatest version number
  • Specific minor versions install and stick with one release permanently, like 8.0.*, only installing patch updates like 8.0.8

Note

Long-Term Support (LTS) versions like 8.0 are released each November of odd-numbered years like 2023, have even major version numbers, and come with 3 years of support. Standard Term Support (STS) versions like 7.0 are released each November of even-numbered years like 2022, with odd version numbers and 1.5 years of support.

Then, once you know which package you want, you can install it with apt install <packagename>, for example, sudo apt install dotnet-runtime-latest.

Tip

Multiple .NET packages can be safely installed at the same time, even from different versions. For example, you can have both .NET 6 Runtime and .NET 8 Runtime installed side-by-side without causing a conflict. At run time, the .NET host framework resolver will choose the correct .NET runtime with which to launch each app based on Roll Forward settings and the app's target framework.

Latest version

This will install the latest .NET version, regardless of whether it is an LTS or STS release. It will upgrade to greater major and minor versions, including new STS versions. It will never install previews or release candidates.

For example, if you apt install dotnet-runtime-latest in March 2024, it will install .NET Runtime 8. Later, if you run apt upgrade in December 2024, .NET 9 will have been released, so it will install .NET Runtime 9.

Installation Package name Purpose Also auto-installs
.NET Runtime dotnet-runtime-latest Run .NET CLI apps
ASP.NET Core Runtime aspnetcore-runtime-latest Run .NET web apps .NET Runtime
.NET SDK dotnet-sdk-latest Build .NET apps .NET & ASP.NET Core Runtimes

Tip

If you find that a .NET application does not run after a major version upgrade, you can choose a different Roll Forward behavior. For example, you can set the DOTNET_ROLL_FORWARD environment variable to LatestMajor.

Latest LTS version

This will install the latest Long Term Support .NET version. It can upgrade to greater major and minor LTS versions. It will never install an STS, release candidate, or preview release.

For example, if you apt install dotnet-runtime-latest-lts in March 2024, it will install .NET Runtime 8. Later, if you run apt upgrade in December 2024, it will upgrade to the latest 8.0.* release, but will not install the newly released .NET 9, because 9 is an STS release. It will stay on .NET 8 until November 2025, when .NET 10 is released, which is an LTS version like 8.

Installation Package name Purpose Also auto-installs
.NET Runtime dotnet-runtime-latest-lts Run .NET CLI apps
ASP.NET Core Runtime aspnetcore-runtime-latest-lts Run .NET web apps .NET Runtime
.NET SDK dotnet-sdk-latest-lts Build .NET apps .NET & ASP.NET Core Runtimes

Tip

If you find that a .NET application does not run after a major version upgrade, you can choose a different Roll Forward behavior. For example, you can set the DOTNET_ROLL_FORWARD environment variable to LatestMajor.

Specific minor version

If you want to stay on a specific minor version of .NET, such as 8.0, then you can apt install dotnet-runtime-8.0 or one of the other numbered packages. This example will install .NET Runtime 8.0 and only ever upgrade it to newer patch versions, like 8.0.3, but never to newer major or minor versions like 9.0 or 10.0. It will not install previews or release candidates either.

Installation Package names Purpose Also auto-installs
.NET Runtime dotnet-runtime-8.0
dotnet-runtime-7.0
dotnet-runtime-6.0
Run .NET CLI apps
ASP.NET Core Runtime aspnetcore-runtime-8.0
aspnetcore-runtime-7.0
aspnetcore-runtime-6.0
Run .NET web apps .NET Runtime
.NET SDK dotnet-sdk-8.0
dotnet-sdk-7.0
dotnet-sdk-6.0
Build .NET apps .NET & ASP.NET Core Runtimes

Update installed packages

Patch versions

When a new .NET patch version is released, you can update the installed packages to the new version.

sudo apt update
sudo apt upgrade

Important

Be sure to restart any running .NET applications after installing a new version of the runtime they were using, or else they may mysteriously crash much later when a dynamically-loaded file cannot be found in an old, now-deleted directory.

Major and minor versions

If you want to update to a new major or minor version, you will need to have installed one of the latest packages, such as dotnet-runtime-latest or aspnetcore-runtime-latest-lts, before you apt update.

Alternatively, you can manually choose a new minor version to install using a command like sudo apt install dotnet-runtime-8.0.

Automatic updates

To automatically install package updates without any user interaction, see Debian Reference § 2.7.3: Automatic download and upgrade of packages.

List installed versions

dotnet --info
apt list --installed 'dotnet-*' 'aspnetcore-runtime-*'

Compatible versions

Operating systems and .NET releases

Raspberry Pi OS .NET 8 .NET 7 .NET 6
Bookworm (12) 1
Bullseye (11) 1
Buster (10) 2 1

✅ = Functional and currently officially supported
☑ = Functional but not currently officially supported
❌ = Incompatible

Release information
Other OS distributions

In addition to Raspberry Pi OS, you should also be able to install these .deb packages on ARM builds of Debian and other Debian-based distributions like Ubuntu and Mobian, because these packages are not specific to Raspberry Pi OS and only depend on packages in the standard Debian repository.

CPU architectures

✅ 64-bit/ARM64/AArch64/ARMv8
✅ 32-bit/ARM32/AArch32/ARMv7/armhf

Raspberry Pis

Raspberry Pi 5
Raspberry Pi 4
Raspberry Pi 3
Raspberry Pi 2
✅ Other Raspberry Pis that have an ARMv7 or greater CPU, such as Pi Pico 2, Compute Module 3 and 4, Pi Zero 2 W, and Pi 400
Raspberry Pi 1, Pi Pico, Compute Module 1, and Pi Zero are not compatible with .NET because they only have an ARMv6 CPU, and .NET requires ARMv7 or later

Developer information

Application package dependencies

If you are a developer who maintains an APT package for a .NET application, you can declare a dependency on one of the packages in this repository to automatically install the correct .NET runtime when a user installs your package.

It is recommended to declare a dependency on a virtual package with a metapackage alternative. This way, it allows users to use newer .NET versions if they already have one installed. If your application targets a minimum version of .NET Runtime 6, for example, you can add this to your package's control file.

Depends: dotnet-runtime-latest | dotnet-runtime-6.0-or-greater

If the user already has .NET Runtime 6, 7, or 8 installed, your app can launch with their existing runtime without downloading any new runtimes. Otherwise, the app package installation will automatically include .NET Runtime 8, or whatever the latest version is at the time.

There are virtual packages to represent minor version inequalities for other packages too, not just the above example (like aspnetcore-6.0-or-greater and dotnet-sdk-6.0-or-later) and other versions (like dotnet-runtime-7.0-or-greater and dotnet-runtime-8.0-or-greater).

To allow your application to run with newer major runtime versions, be sure to add a Roll Forward behavior to your .csproj project file or *.runtimeconfig.json runtime configuration file.

<PropertyGroup>
    <RollForward>LatestMajor</RollForward>
</PropertyGroup>
{
    "runtimeOptions": {
        "rollForward": "LatestMajor"
    }
}

DEB package and APT repository formats

To learn how to create your own DEB packages and serve them in an APT repository, you can refer to Debian APT package repository format. The formats are confusing, misguided, and poorly designed, while their documentation is scattered and complex. This wiki page is an effort to accurately distill the steps to create simple repositories into the relevant information that covers normal cases while still being precise and avoiding common problems.