Search code examples
c#asp.net-corenuget.net-7.0

How to use AddProblemDetails extension in class library?


I want to write custom extension using brand new Asp.Net Core 7.0 AddProblemDetails extension in class library.

I tried to add Microsoft.AspNetCore.Http.Extensions and Microsoft.Extensions.DependencyInjection nuget packages, but that didn't help. What package reference should I include to do that?


Solution

  • If you want to use the ASP.NET Core shared framework in a class library project - add FrameworkReference element for Microsoft.AspNetCore.App:

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