You can just add <FrameworkReference Include="Microsoft.AspNetCore.App"/>
to library projects .csproj
file as mentioned in the docs:
<Project Sdk="Microsoft.NET.Sdk">
<!--... rest of file-->
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<!--... rest of file-->
</Project>