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

SkiaSharp restores OpenTK libraries not compatible with net 5.0 #1803

Open vbaros opened 2 years ago

vbaros commented 2 years ago

I'm using SkiaSharp on Windows. My project is targeting net5.0. When I restore SkiaSharp nuget package this is the warning I get:

Warning NU1701: Package 'OpenTK 3.1.0' 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' instead of the project target framework 'net5.0-windows7.0'. This package may not be fully compatible with your project.

Warning NU1701: Package 'OpenTK.GLControl 3.1.0' 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' instead of the project target framework 'net5.0-windows7.0'. This package may not be fully compatible with your project.

I know OpenTK library is already updated to work with net 5.0 but I do not see OpenTK.GLControl being updated any more. The question is if we OpenTK.GLControl can be removed from SkiaSharp or replaced with some other control? Also can OpenTK dependency be updated to newer version targeting net 5.0? I know I can do that directly in my project but it would be nice to have that directly from the nuget package.

Gnimuc commented 2 years ago

You need to install GLWpfControl v4.1.0:

Install-Package OpenTK.GLWpfControl -Version 4.1.0

You may also need to downgrade OpenTK to [4.3, 4.4].

NogginBops commented 2 years ago

There actually is an updated version of GLControl. You can find it here: https://www.nuget.org/packages/OpenTK.WinForms/4.0.0-pre.6 https://github.com/opentk/GLControl

It's a "prerelease" but it's been stable since we released it so you can think of it like a release candidate.

Gnimuc commented 2 years ago

Does it support WPF?

令和3年10月28日(木) 8:45 Julius Häger @.***>:

There actually is an updated version of GLControl. You can find it here: https://www.nuget.org/packages/OpenTK.WinForms/4.0.0-pre.6 https://github.com/opentk/GLControl

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mono/SkiaSharp/issues/1803#issuecomment-953388962, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYXW5MMJQCQSXCJRDE4V53UJCMKFANCNFSM5DW6Z2TA .

NogginBops commented 2 years ago

If you are looking for a Wpf control GLWpfControl is the best option. I think that GLControl will have the airspace issue when used in a WindowsFormsHost. But I'm not sure.

dbowser commented 2 years ago

There actually is an updated version of GLControl. You can find it here: https://www.nuget.org/packages/OpenTK.WinForms/4.0.0-pre.6 https://github.com/opentk/GLControl

It's a "prerelease" but it's been stable since we released it so you can think of it like a release candidate.

I have included that package but still get the warning... How can I prevent that from appearing?

jeremy-visionaid commented 1 month ago

@mattleibow This is a bigger problem for SkiaSharp.Views.WindowsForms 3.0.0-preview.x since previously SkiaSharp could be used in a WinForms app by referencing SkiaSharp.Views.Desktop.Common. But the Extensions have now been moved to SkiaSharp.Views.WindowsForms, which leads to NU1701 if attempting to use it (it resolves to net462 rather than net7.0-windows10.0.19041).