In an effort to make it possible to build ASP.NET Core from source code only on a single machine without access to NuGet.org or already-built assets, we need to revisit the structuring of our package dependencies. The NuGet package that contains Libuv bundles binaries built on macOS, Windows, and Linux. This means it is not possible to build the package, Libuv.nupkg, from source code only -- you must have multiple machines. Furthermore, because Microsoft.AspNetCore.App depends on this package via transitive reference through Microsoft.AspNetCore.Server.Kestrel, a project restore against source-built only packages cannot succeed in offline mode.
We went over ways we could solve this. This includes:
Split Kestrel packages into two packages following the pattern set by EFCore.Sqlite.Core/EFCore.SQLite. This would decouple packages that deliver the managed assemblies from those that deliver native binaries. The managed package binaries can be built from source, the native cannot. Remove the native package from the dependency graph of Microsoft.AspNetCore.App.
Downsides: adds more packages that can make it more confusing on which package to use.
Create NuGet features that allow us to build a more configurable package dependency graph. For example, NuGet/Home#2391.
Downsides: more NuGet complexity, lots more work, no planned NuGet features that would solve this yet.
Split the Libuv package into many packages, one per supported runtime identifier. Libuv remains as a metapackage.
Downsides: doesn't solve the offline restore problem
For other reasons, we already had a plan to switch the default Kestrel transport from Libuv to sockets. When we do this, we could remove Libuv from Microsoft.AspNetCore.App.
Downsides: breaking change.
After discussing alternatives and options, we landed on the last solution, removing Libuv from Microsoft.AspNetCore.App. Although the first option (decoupling native from managed packages) would also have worked, we felt this added more complexity that necessary since we already wanted to make sockets the default transport.
This change will have the following implications:
- Change the default transport to sockets.
- Remove the package dependency from Microsoft.AspNetCore.Server.Kestrel to Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.
- Remove Libuv from the Microsoft.AspNetCore.App package graph.
- Keep Libuv in Microsoft.AspNetCore.All
- Ensure we have feature parity between Libuv and Sockets. One known gap: https://github.com/aspnet/KestrelHttpServer/issues/2231