Why isn't C# .NET MAUI supported?

Can anybody help shed some light on why publishing cross-platform .NET is not supported?

I can publish an apk in a GitHub yaml file using Ubuntu with actions/setup-dotnet@v4, or from ubuntu/dotnet-runtime:latest, or Debian with these instructions: Install .NET on Debian - .NET | Microsoft Learn

I’m new here, but if the F-Droid image doesn’t have .NET, then can’t it be added like this?

wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt-get update && sudo apt-get install -y dotnet-sdk-8.0

See Also:

You’ve read Inclusion Policy | F-Droid - Free and Open Source Android App Repository see “Though we tried to build everything from source, we still need some prebuild binaries. Therefore we have some exceptions:…” ?

Some random Microsoft repo is not on that exception list…

What distro builds and packages it from FOSS code only?

Also related build Xamarin apps on buildserver (#1529) · Issues · F-Droid / Data · GitLab

Okay so you need to install .NET without using a package manager, so like this then? Install .NET on Linux without using a package manager - .NET | Microsoft Learn

DOTNET_FILE=dotnet-sdk-8.0.100-linux-x64.tar.gz
export DOTNET_ROOT=$(pwd)/.dotnet
mkdir -p "$DOTNET_ROOT" && tar zxf "$DOTNET_FILE" -C "$DOTNET_ROOT"
export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools

build…we need it built in a FOSS way from FOSS code…

1 Like

.NET can be built from the source files by following these instructions:

git clone https://github.com/dotnet/dotnet dotnet-dotnet
cd dotnet-dotnet
./prep.sh
./build.sh --clean-while-building --online
mkdir -p $HOME/dotnet
tar zxf artifacts/[your-arch]/Release/dotnet-sdk-9.0.100-[your-RID].tar.gz -C $HOME/dotnet
ln -s $HOME/dotnet/dotnet /usr/bin/dotnet

.NET is not something like golang that you can bootstrap with GCC in few minutes. It’s impossible to bootstrap it from source. We can’t simply rebuild it on our buildserver. Fortunately Ubuntu packages it, though I guess it’s not bootstraped from source. That’s good enough. Then the problem is that we don’t use Ubuntu. Someone needs to figure out how to use the package on our buildserver.

so it’s not FOSS lol

2 Likes

Debian doesn’t bootstrap everything from source, either. :person_shrugging: Only Guix does that. :slight_smile:

2 Likes

Then the problem is that we don’t use Ubuntu. Someone needs to figure out how to use the package on our buildserver.

Someone already has, but it looks like you’ve commented on that already.

Here’s an updated version of @nmatveev’s solution.

FROM debian:bookworm-slim
LABEL Name=dotnet-sdk-from-ubuntu-universe Version=0.0.2

# TODO: Update to .NET 8.0 when the next Ubuntu LTS is released (jammy = 22.04)
# See also: https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#supported-distributions
ARG UBUNTU_VERSION="jammy"
ARG DOTNET_SDK_VERSION="6.0"

RUN <<EOF
    set -e
    apt-get -y update && apt-get install -y gnupg
    echo "deb https://archive.ubuntu.com/ubuntu ${UBUNTU_VERSION} main universe" >> /etc/apt/sources.list
    gpg --no-default-keyring --keyring "/etc/apt/trusted.gpg.d/dotnet-sdk.gpg" --keyserver "hkp://keyserver.ubuntu.com" --recv-keys "871920D1991BC93C"
    apt-get -y update && apt-get install -y dotnet-sdk-${DOTNET_SDK_VERSION}
    apt clean
EOF

CMD ["sh", "-c", "dotnet --version"]

Oh, it does!

Hey Kisuk Urahara :slight_smile:

1 Like

According the the Inclusion Policy, “Though we tried to build everything from source, we still need some prebuilt binaries.” What’s stopping us from adding dotnet as a prebuilt binary?
Microsoft says, “All aspects of .NET are open source including class libraries, runtime, compilers, languages, ASP.NET Core web framework, Windows desktop frameworks, and Entity Framework Core data access library, and more.”
Surely dotnet counts under the “some other compilers/build tools” exception category, so why not say so?

We don’t want to add more exceptions. If you go through the list, you’ll found that those exceptions are mostly FOSS and can be built from source.

  • Android SDK/NDK: The binaries are under a proprietary license, but the source code are under Apacke 2.0. Some old versions are packaged in Debian.
  • Gradle: Mostly FOSS and old versions are packaged in Debian. New versions have weird build deps under a proprietary license.
  • Flutter SDK, JSC/Hermes, Nix packages, pip packages, Rust/Rustup: FOSS and can be built easily. But that takes too much resources so we use upstream binaries currenly.
  • Golang, Nodejs and other not mentioned compilers including sbt: FOSS and packaged in Debian. We use the binaries only when the version is not packaged yet or not in the Debian version we use. In fact we build golang from source currently.

Dotnet is a different case. It’s never packaged in Debian and I don’t know if it can really be packaged. When I checked that last time the binary has some license problem but it seems that has been solved. And we consider the Ubuntu package is FOSS so we can use that. That said, we still need to check MAUI which is used to build Android apps with dotnet. Currently there is no dotnet app in F-Droid so we don’t have dotnet in the exception list. But if someone finally packages a dotnet app for F-Droid we can update that page.

And there are only few dotnet FOSS apps available. The most popular one is Bitwarden. I did some test to package Bitwarden for F-Droid but failed. Since Bitwarden will be rewrite in Kotlin I won’t spend more time on that. If you want to package other dotnet apps for F-Droid, you should use the Ubuntu package. We also had a try on that path but it doesn’t work on Bullseye. We recently upgraded our buildserver to Bookworm so you have have another try.

1 Like

Thanks for the reply.

It’s never packaged in Debian and I don’t know if it can really be packaged.

It looks like it is packaged now, by adding the Microsoft package repository. If so, can I use it in an F-Droid project? If so, does it need to be mentioned in the Inclusion Policy?

Read above, that command works IF you add THEIR repos

else: Debian -- Package Search Results -- dotnet-sdk no, it’s not IN Debian

How is that less open-source than Android or Gradle? .NET is just not as easy to build as Flutter or Rust.

We have to use Android SDK and Gradle. But there is no reason to add a exception for dotnet. Maybe only one or two FOSS apps use it. Of course, any help is welcome.

I asked the dotnet project if it’s FOSS, and their responses were quite compelling.
After all that, is it okay if I submit a pull request with the dotnet SDK from Ubuntu added to the build?

Yes, we have discussed that and we thoguht that installing dotnet from Ubuntu repo is good enough.