Closed
Description
Problem
Currently, projects which reference ASP.NET Core get compilation references from NuGet packages. When using Microsoft.AspNetCore.App 2.1, this results in the compiler referencing 168 .dll files from NuGet packages. These .dll files also happen to be the implementation binaries used in some scenarios. This has some negative consequences, such as (but not limited to):
- Build perf: A simple netcoreapp2.1 + Microsoft.AspNetCore.App project requires 277 NuGet packages. This has a noticeable impact on all project operations involving NuGet. Even with optimizations like offline restore and NuGet's no-op restore, there is a noticeable amount of time spent on restore. This is visible both on command line "dotnet restore" and in VS UI.
- Disk space: These 277 packages also bring down hundreds of other files that are never used for a netcoreapp2.1+ project. The SDK and NuGet must filter through all these to provide the actual set of assets required to compile and run an app. This adds time to project commands like build, publish, test, etc.
- Offline cache: Offline packages caches in Azure Web Apps, Visual Studio, and the .NET Core SDK have become quite large (~1.0 GB) to satisfy offline restore scenarios.
- Versioning quirks: There is no good answer for how to version each of those hundreds of NuGet packages. There is tension between avoiding re-shipping binaries which haven't changes, and having a sensible, consistent versioning.
Proposed solution
Let's update Microsoft.AspNetCore.App to follow the pattern established by Microsoft.NETCore.App in 2.0.0. This requires 2 breaking changes.
- Remove all NuGet package dependencies from Microsoft.AspNetCore.App
- Produce reference references for compilation. Microsoft.AspNetCore.App only includes reference assemblies, and does not result in restoring unnecessary packages
Requirements
Microsoft.AspNetCore.App must:
- Contain a "runtime.json" file. Required for self-contained deployment (see details in # Produce platform-specific packages for Microsoft.AspNetCore.App #3607)
- Place all ref assemblies in
ref/netcoreapp3.0/*.dll
FYI prototype: aspnet/AspLabs#25