How to install .NET 7 SDK in Fedora 37 today

How to install .NET 7 SDK in Fedora 37 today

The word today in the title is just because by the time I write this article, there isn't an official Microsoft .NET 7 package repository for Fedora 37.

Eventually, Microsoft will make a Fedora 37 repo. While that doesn't happen we can use the rpm packages from Microsoft Fedora 36: https://packages.microsoft.com/fedora/36/prod/

How to do that?

Create a file called microsoft-fedora.repo in /etc/yum.repos.d/, with the content:

[packages-microsoft-com-prod]
name=microsoft-fedora-prod
baseurl=https://packages.microsoft.com/fedora/36/prod/
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc

If you haven't added Microsoft's GPG key yet, you should do now:

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc

Then you can do:

sudo dnf update
sudo dnf install dotnet-sdk-7.0

That's it - Microsoft .NET 7 SDK will be available on Fedora 37.

When Microsoft officially releases the packages for Fedora 37, you can just update the repo file (/etc/yum.repos.d/microsoft-fedora.repo) and replace 36 with 37.