mono / SkiaSharp

SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library. It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
MIT License
4.3k stars 532 forks source link

Nuget restore fails with NU1202: Package OpenTK.GLControl 3.0.1 is not compatible with net6.0 on Azure DevOps #2335

Open nikamvd opened 1 year ago

nikamvd commented 1 year ago

I have Xamarin.Forms project that uses SkiaSharp : 2.88.3 SkiaSharp.Views.Forms : 2.88.3

Nuget restore for unit test project which includes the shared library fails on the devops pipeline (Azure) -

[error]The nuget command failed with exit code(1) and error(NU1202: Package OpenTK.GLControl 3.0.1 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package OpenTK.GLControl 3.0.1 supports: net20 (.NETFramework,Version=v2.0)

NU1202: Package OpenTK 3.0.1 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package OpenTK 3.0.1 supports: net20 (.NETFramework,Version=v2.0) NU1202: Package OpenTK 3.0.1 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package OpenTK 3.0.1 supports: net20 (.NETFramework,Version=v2.0) NU1202: Package OpenTK.GLControl 3.0.1 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package OpenTK.GLControl 3.0.1 supports: net20 (.NETFramework,Version=v2.0) NU1202: Package OpenTK 3.0.1 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package OpenTK 3.0.1 supports: net20 (.NETFramework,Version=v2.0) NU1202: Package OpenTK.GLControl 3.0.1 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package OpenTK.GLControl 3.0.1 supports: net20 (.NETFramework,Version=v2.0) Errors in /Users/runner/work/1/s/test/*Test.csproj NU1202: Package OpenTK.GLControl 3.0.1 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package OpenTK.GLControl 3.0.1 supports: net20 (.NETFramework,Version=v2.0) NU1202: Package OpenTK 3.0.1 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package OpenTK 3.0.1 supports: net20 (.NETFramework,Version=v2.0)

fverdou commented 1 year ago

I have the same problem with incompatibility with net7.0 after upgrading to it from .netcore3.1 for some unit test projects in our Xamarin solution because it will stop being supported at some point. Did you find any workaround?

e1T commented 1 year ago

I experience the same issue, but was able to find a temporary workaround by first removing the SkiaSharp packages from the solution, restoring nuget packages and then re-adding SkiaSharp. Package restore still fails after the last step, but at least I can restore the rest of my packages and run my solution again.

albyrock87 commented 1 year ago

Hey, I've found a workaround: just add packages to your test project with IncludeAssets="None".

<!-- SkiaSharp not compatible with .NET >= 6.0.2xx https://github.com/mono/SkiaSharp/issues/2335 -->
<PackageReference Include="OpenTK" Version="3.0.1" IncludeAssets="None" GeneratePathProperty="true" />
<PackageReference Include="OpenTK.GLControl" Version="3.0.1" IncludeAssets="None" GeneratePathProperty="true" />

If you really need those DLL linked in the test project, you can add something like this:

<Reference Include="OpenTK">
  <HintPath>$(PkgOpenTK)\lib\net20\OpenTK.dll</HintPath>
</Reference>

Or you can just try to include OpenTK 4.x.x in your test project and see if that'd be enough.