Skip to content

[Announcement] Microsoft.AspNetCore.Http.Features split, no longer shipped as a package #32307

@Tratcher

Description

@Tratcher

Microsoft.AspNetCore.Http.Features split, no longer shipped as a package

Microsoft.AspNetCore.Http.Features is being split into two assemblies, Microsoft.AspNetCore.Http.Features and Microsoft.Extensions.Features.

Version introduced

6.0

Old behavior

Microsoft.AspNetCore.Http.Features 5.0 shipped both in the ASP.NET shared framework and as a nuget package.

Microsoft.AspNetCore.Http.Features 5.0 targeted .NET 4.6.1, .NET Standard 2.0, and .NET 5.0

New behavior

Microsoft.AspNetCore.Http.Features 6.0 will ship only in the ASP.NET shared framework, not as a nuget package.

Microsoft.AspNetCore.Http.Features 6.0 will target .NET 6.0 only.

Microsoft.Extensions.Features 6.0 will ship both in the ASP.NET shared framework and as a nuget package.

Microsoft.Extensions.Features 6.0 will target .NET 4.6.1, .NET Standard 2.0, and .NET 6.0

The following types will move to the new assembly. The namespaces will not be changed and type forwards will be added for compatibility.

namespace Microsoft.AspNetCore.Http.Features
IFeatureCollection
FeatureCollection
FeatureReference<T>
FeatureReferences<T>

Reason for change

This allows these core types to be shared more broadly across components, while also allowing the remaining Http specific components in Microsoft.AspNetCore.Http.Features to take advantage of new runtime and language features.

Recommended action

When upgrading to ASP.NET 6.0 remove any packages references for Microsoft.AspNetCore.Http.Features. Add a package reference for Microsoft.Extensions.Features only if required.

Class libraries that need to consume the types from Microsoft.AspNetCore.Http.Features should add a FrameworkReference instead:

  <ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
  </ItemGroup>

https://docs.microsoft.com/aspnet/core/fundamentals/target-aspnetcore?#use-the-aspnet-core-shared-framework

Libraries with out of date references may encounter a TypeLoadException or the following error:

Error	CS0433	The type 'IFeatureCollection' exists in both 'Microsoft.AspNetCore.Http.Features, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' and 'Microsoft.Extensions.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'

This can be mitigated by adding the FrameworkReference shown above to any of the affected projects.

Category

ASP.NET

Affected APIs

IFeatureCollection
FeatureCollection
FeatureReference
FeatureReferences


Issue metadata

  • Issue type: breaking-change

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions