Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm a little bit lost and confused when migrating from .NET Core 2.2. to .NET 5. I've developed as class library which was referencing let's say Microsoft.AspNetCore.Http.Abstractions.

When I create new NET 5 application it implicitly references version 5.0.0 of said assembly (I understand because it uses Microsoft.NET.Sdk.Web, but when class library is created the highest version available from Nuget is 2.2.0.

How can I reference 5.0.0 from class library? Should I reference 2.2.0 (it still downloads it though) and hope that 5.0.0 is backwards compatible? What was the intended usage pattern?

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="???"/>
  </ItemGroup>
</Project>

Edit: I found out that is should be done with:

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

bit this will only work if targetting net5, is it possible to reference said assembly from netstandard2.1? If netstandard2.1 can only reference version 2.2.0 is it safe to do it?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
694 views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...