I wonder if this opens the door for .NET applications to be included in Ubuntu? Neither this blog post nor Ubuntu’s [1] mention that as a possibility.
Just thinking from a Ubuntu package level, where libraries live in packages separate from executables, it might be possible to create library packages using the result of ‘dotnet store’. Then executable packages could reference them when running ‘dotnet publish’. [2] That way multiple executable packages could share common libraries.
Replicating the packages of a language package manager (Nugget in this case) into a system package manager (apt in this case) is probably not fun. You will end up with dependency nightmares or one system package per version of Nugget package. So maybe it’s not worth doing.
Ubuntu briefly included Mono-based apps in the core distribution. Sadly the backlash controversy after that around the size of the Mono runtime (which wasn't much bigger than Python at the time, but got a bit of a "but we've already got Python, we don't need 2 Pythons" in response, and ahead of the whole python2/python3 split, hah) and the worse controversy about Microsoft-adjacent conspiracy theories did a lot of damage to the then-nascent world of Gtk+ based .NET apps in Linux and left some scars.
The first part seems to add confidence that if the right apps/developers came along, Canonical themselves likely wouldn't have a problem putting them in the distribution. The second part would explain why there aren't just apps waiting in the wings for it and why "the community" (or at least certain vocal parts) may still not be as welcoming of .NET-based apps in the distribution this time around like it played out that previous time.
I don’t think it would be wise for apt to repackage or recreate Nuget functionality. The initial install of dotnet should be done by apt, the packages should be handled by Nuget.
If you want to package an application which depends on a library, you have to package the library, too. This is the (pretty much sole) reason that distros package libraries.
From a technical perspective it's pretty much a solved problem for any language ecosystem whose dependency management is reproducible, is uniform enough to support basic automation, and supports some measure of vendorization.
IME (and I worked at Microsoft previously), Nuget and MSBuild have decided that application developers should have full control of their dependencies and that system administrators can override these things but not easily. I understand that distro-level package manager want to make it possible to upgrade a system library for all applications, but the .NET world isn’t going in that direction (yes yes I know about the GAC et al. but that’s more trouble than it’s worth)
The implicitly assumption in the .NET choice is that dependencies may not be backwards compatible, so compile against a specific version and go ahead and ship that assembly in your self-contained deployment. Yes your packages are bigger, but disk space and bandwidth are cheaper than developer time and support costs.
Application developers can still pin their in-ecosystem library dependencies to exact versions and have downstream, distro-level package managers respect that while building everything from source and making the system package manager aware of all of those library versions in more or less the usual way. (That's how building Rust and Go applications already works on NixOS, for example.)
That's why I say it's largely a solved problem for language ecosystems that tick a few basic boxes.
Can't Nuget and MSBuild support this? Can they not dump lockfiles like common build tools for Rust, Go, Javascript, Haskell, Python, Nim, PHP, etc., do? Is there a general problem (like there is with Java) where actually building from source is so difficult that it is rarely done?
Anyway there's already a suite of Linux packaging options built around the kind of app distribution model Microsoft expects, and Canonical even has one of their own! I don't see why they wouldn't support distributing .NET applications as Snaps, or maybe even automating the creation of Snap packages for .NET applications.
There is no immediate problem with building from source, there simply isn't much of a benefit to doing so. An assembly compiled with different optimizing C# compilers will be virtually identical assuming the source files are identical. I can think of a reason not to compile from source: it's essentially statically linking code into your assembly which can be huge problem for middleware packages that want to override the specific version you depend on. This is very common with the JSON serialization library, which is highly backwards compatible.
I think historically in the .NET world, package consumers have expected pre-compiled assemblies and not source code and so that's what the ecosystem has developed around.
> I can think of a reason not to compile from source: it's essentially statically linking code into your assembly which can be huge problem for middleware packages that want to override the specific version you depend on. This is very common with the JSON serialization library, which is highly backwards compatible.
I think if .NET were integrated into Linux package management systems in the 'organic' way, 'building from source' here would still be 'building from source with the assistance of the distro package management tooling', which would mean that you would get intermediate build artifacts for all the deps, recursively.
If you have to do that manually, it would suck. But when automated tools can generate those packages, it works relatively nicely.
> I think historically in the .NET world, package consumers have expected pre-compiled assemblies and not source code and so that's what the ecosystem has developed around.
Yeah, and I can see how distros burning their own compute bandwidth building the same binaries into their own artifact repository systems instead of using Nuget might seem like more of a religious rite than a purposeful task.
But I think the ability to uniformly inspect and update the software on the system is a big deal when it comes to Linux distros, as is the ability to add source patches, especially for backwards compatibility or security fixes, to most people involved in putting distros together.
I don't know if Canonical is up for it with Ubuntu, but it does sound like building dotnet applications in a way that is conventional for Linux distros is certainly possible. Alternatively, something like AppImage, Flatpak, or Snap seems like a natural fit for distributing apps with libraries shipped directly by the publisher that Ubuntu or other distros could use to include .NET applications.
Yes I think it is possible to ship dotnet applications and packages as apt or other image formats. What I would do is to put the Nuget package inside the deb package, extract it into the local Nuget cache, and then let Nuget discover it as if it had downloaded it.
Unfortunately, packaging applications built on .NET is still a challenge for any OS that wants to build everything from source and doesn't allow network access. Like you say, duplicating nuget into os-app-package-manager is challenging. Even side from the duplication, we need to bootstrap the ecosystem, in particular dealing with cyclic dependencies and version explosion as a result of all the different versions of all the dependencies that an average dotnet application needs.
Ironically, .NET is positioned to use a shared runtime but Linux has all the package manager tooling and Microsoft's never took off. The buggy nature of shared runtimes on Windows meant that the culture is to ship a full runtime with your .NET app.
I'm not sure going back to shared runtime libs is worth the headache but I guess if you were really resource constrained but running .NET it would work for you.
Just thinking from a Ubuntu package level, where libraries live in packages separate from executables, it might be possible to create library packages using the result of ‘dotnet store’. Then executable packages could reference them when running ‘dotnet publish’. [2] That way multiple executable packages could share common libraries.
Replicating the packages of a language package manager (Nugget in this case) into a system package manager (apt in this case) is probably not fun. You will end up with dependency nightmares or one system package per version of Nugget package. So maybe it’s not worth doing.
[1]: https://ubuntu.com/blog/install-dotnet-on-ubuntu
[2]: https://docs.microsoft.com/en-us/dotnet/core/deploying/runti...