aspnet / MetaPackages

[Archived] NuGet meta packages. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
211 stars 109 forks source link

ASP.NET Core Shared Framework ("runtime") #248

Closed glennc closed 6 years ago

glennc commented 6 years ago

This is a tracking issue for delivering ASP.NET Core and related libraries as a cohesive set that are consumed and behave like a .NET platform, as opposed to standard NuGet packages.

Packages (state of the world as of 2.0)

ASP.NET Core (and by extension, Entity Framework Core and the Microsoft.Extensions.* libraries) is designed, built, and deployed as a series of .NET Standard NuGet package libraries that together form the larger framework. The framework, in turn, runs on various .NET platforms, including .NET Framework, .NET Core, and Mono. Entity Framework Core and the various Microsoft.Extensions.* libraries also run and are supported on other .NET platforms like UWP and Xamarin.

There are aspects of working with such a large set of packages however that are less than desirable to the developer experience. As such, some features were built for 2.0 to mitigate some of the issues.

This applies to all packages with the Microsoft.AspNetCore, Microsoft.EntityFrameworkCore, and Microsoft.Extensions prefixes, as well as their dependencies, which include both first-party (Microsoft) and third-party libraries.

Benefits of packages

Issues with packages

Runtime Store

.NET Core 2.0 introduced the Runtime Store as a way to install runtime assets from NuGet packages into a global location. The assets are optimized for the current platform (via CrossGen), and at runtime the host will load assets from the runtime store in the case that application requires the asset but doesn't have it in its bin folder. Assets expected to be in the runtime store of the machine an application is being published to can be excluded from the publish output of the application (its bin) by passing a manifest to the publish command.

ASP.NET Core 2.0 shipped the entire closure of its libraries, up to and including third-party dependencies, in the runtime store, and the meta-package used by ASP.NET Core 2.0 applications by default (Microsoft.AspNetCore.All) configures the publish command to exclude these assets by default. Thus, all ASP.NET Core 2.0 projects are published without the ASP.NET Core libraries by default, meaning they will only run on a server where the runtime store has previously been installed.

Benefits of the runtime store

Issues with the runtime store

ASP.NET Core Shared Framework

To address the issues of using the runtime store to deliver the framework assets, the .NET Core host & SDK will be updated to support ASP.NET Core being a "shared framework" with similar semantics to the existing shared framework, Microsoft.NETCore.App.

Note that the .NET Core host will continue to support resolution of other libraries from the runtime store and the SDK will continue to support trimming on publish by way of a target manifest, but ASP.NET Core will not use these mechanisms moving forward.

Requirements

Benefits of a shared framework

Version "train" locking

To address the issue of framework components delivered in packages being silently lifted to newer versions, out of step with the rest of the framework and thus untested and unsupported, the Microsoft.AspNetCore.All meta-package will be changed to specify package dependency ranges, that ensure that only the excact version specified for each dependency is allowed. Any other dependency that attempts to lift a version for a component beyond what is specified in the meta-package will result in a NuGet warning, which the Microsoft.NET.Sdk will elevate to an error by default. Users will be able to suppress the error manually if they wish to lift the dependency anyway, but at that point they would be considered unsupported.

guardrex commented 6 years ago

Regarding the runtime store feature whereby additional packages (outside of those in Microsoft.AspNetCore.All) can be deployed in advance and apps published against a manifest of those additional packages: Is that feature going to survive?

[EDIT] Just found out that [@]DamianEdwards provided an overview of the changes on the Standup :point_right: https://youtu.be/rnFrOauYrkY?t=47m44s

DamianEdwards commented 6 years ago

@guardrex yes, there is no plan to remove the runtime store functionality from the dotnet host or CLI, just its use by ASP.NET Core to deliver the entire framework.

johnkors commented 6 years ago

Maybe a https://github.com/dotnet/announcements is in order..?

I was considering creating scripts for installing aspnet core (all) into the runtime store on our frontend servers, but after acceidentally finding this issue, it looks like that would be a waste of time?

Looks like the install scripts already support the new AspNet Core Shared Runtime : https://github.com/dotnet/cli/pull/8333

DamianEdwards commented 6 years ago

@johnkors I'll add an announcement for this as it pertains to the upcoming 2.1 releases

dasMulli commented 6 years ago

Is there any plan to make the .app package a flat package like microsoft.netcore.app? That would have the benefit of making the build really fast and existing conflict resolution infrastructure of the SDK should already contain the means to trim otherwise acquired individual packages out of the dependency tree (provided the necessary conflict resolution info is provided by the metapackage).

DamianEdwards commented 6 years ago

Closing this as feature work for this is complete.