Microsoft.AspNetCore.Authentication.Abstractions
on its own is deprecated and now is part of Microsoft.AspNetCore.App.Ref
package. But that package is an internal implementation of the .NET Core SDK and is not meant to be used as a normal PackageReference. Ok, but I want to use IClaimsTransformation and IHttpContextAccessor interfaces for example in a library, not in the actual application. Changing the SDK reference of the library project from Microsoft.NET.Sdk
to Microsoft.NET.Sdk.Web
introduces other issues, as that is meant for the startup application.
So how can I create a library that can use those types? What package should I add, or which SDK should I switch over to?
Update
@yehor-androsov pointed me towards FrameworkReference
. That's the one. More details: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/target-aspnetcore?view=aspnetcore-8.0&tabs=visual-studio
I used to convert my library project to console app with an empty Program.cs Main method because Web SDK requires project to be executable, but Framework reference can be included in your library instead.
<FrameworkReference Include="Microsoft.AspNetCore.App" />
Great explanation what Framework reference is here:
What does <FrameworkReference Include="Microsoft.AspNetCore.App" /> actually do in .NET Core 3+?