LibGit2Sharp should target netstandard
aaronpburke opened this issue · comments
PR 2026 changed the lib from targeting netstandard2.0 to net6.0 and netframework472. What was the rationale behind this decision? This means I'm unable to include LibGit2Sharp in my netstandard2.0 library's package references without it throwing a warning.
Targeting netstandard2.0 will encompass netframework472, net6, and net7.
Reproduction steps
Create a netstandard2.0 library project with <PackageReference Include="LibGit2Sharp" Version="0.27.2" />
Expected behavior
Library compiles without warnings.
Actual behavior
Upon building my netstandard2.0 library which references LibGit2Sharp, I receive the following warning:
warning NU1701: Package 'LibGit2Sharp 0.27.2' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
Version of LibGit2Sharp (release number or SHA1)
0.27.2
Operating system(s) tested; .NET runtime tested
Ubuntu-20.04, .NET 6 app which links to netstandard2.0 library; netstandard2.0 library links to LibGit2Sharp.
LibGit2Sharp is not a typical library and must know what underlying platform it's being run on to ensure that the native libraries are loading properly, so it very intentionally doesn't target netstandard2.0
at this point.
For the scenario of using LibGit2Sharp in an intermediate netstandard2.0
assembly, it theoretically should be possible to build a ref
assembly for netstandard2.0
and not a lib
assembly, but that is still problematic since it shifts the problem to the consumer of the intermediate library. If the project targets something other than what LibGit2Sharp has said is its minimum supported versions, then the project would get some rather strange errors from the transitive reference to LibGit2Sharp.