简体   繁体   中英

Cannot install Visual Studio C# NuGet package

I'm writing a Unity app, and i keep experiencing game engine freeze when I use LoadImage on a large JPG, so i decide to try to decode the JPG image on a thread (so as not to freeze the main thread by decoding the JPG on the main thread which is my theory as to why the freeze is happenning).

The plan is, after the thread decodes the JPG, use the main thread to call LoadRawImageData to load the decoded image data into a texture, which should be fast since it doesnt have to decode anything.

To do all that i need to find a JPG decoder package, so in the Visual Studio NuGet package manager i saw the package "LibJpeg.NET" which claims to have no dependencies, but when i try to install the package in my Visual Studio Unity project which uses .Net 3.5 i get the Nuget error

Could not install package 'LibJpeg.NET-ts 2.0.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v3.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

Anybody knows how to solve this, or maybe anybody knows another free .NET 3.5 compatible cross platform (Windows/Mac/iOS/Android) JPEG decoder package i can use on a thread in Unity to decode a JPG?

If you check the nuget package page , it says that you cannot install it if your application targets any version lower than .Net framework 4.

Supported platforms .NET 4 and higher, Windows 8 and higher, Windows Phone Silverlight 8 and 8.1, Windows Phone 8.1 and higher, Silverlight 5, Xamarin Android, Xamarin iOS (Classic and Unified API). The package also includes an assembly for .NET Core, Standard Library 1.0.

If you want your project to be used on windows / linux / max, then it should be targetting to .net standard (ie .Net core ) version.

Once you target to .net standard, you would be either able to use same package or you would be able to use some other libraries eg BitMiracle.LibJpeg.NET OR libjpeg-turbo-net

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM