c# - 无法安装 Visual Studio C# NuGet 包

标签 c# visual-studio unity-game-engine

我正在编写一个 Unity 应用程序,当我在大型 JPG 上使用 LoadImage 时,我不断遇到游戏引擎卡住的情况,因此我决定尝试在线程上解码 JPG 图像(以免卡住主线程)在主线程上解码 JPG,这是我关于为什么会发生卡住的理论)。

计划是,线程解码 JPG 后,使用主线程调用 LoadRawImageData 将解码的图像数据加载到纹理中,这应该很快,因为它不需要解码任何内容。

为了完成所有这些工作,我需要找到 JPG 解码器包,因此在 Visual Studio NuGet 包管理器中,我看到了包“LibJpeg.NET”,它声称没有依赖项,但是当我尝试在我的中安装该包时使用 .Net 3.5 的 Visual Studio Unity 项目出现 Nuget 错误

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.

有人知道如何解决这个问题,或者也许有人知道另一个免费的 .NET 3.5 兼容跨平台(Windows/Mac/iOS/Android)JPEG 解码器包,我可以在 Unity 的线程上使用它来解码 JPG?

最佳答案

如果您检查 nuget package page ,它表示如果您的应用程序的目标版本低于 .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.

如果您希望您的项目在 windows/linux/max 上使用,那么它应该面向 .net standard (即 .Net core )版本。

一旦您瞄准 .net 标准,您将能够使用相同的包,或者您将能够使用一些其他库,例如 BitMiracle.LibJpeg.NETlibjpeg-turbo-net

希望这有帮助。

关于c# - 无法安装 Visual Studio C# NuGet 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54948546/

相关文章:

c++ - 构建输出与项目构建顺序不匹配

c# - 向 Excel 表格添加一行

c# - 错误 : Unable to find Mono. 确保 Mono 的 '/bin' 文件夹已添加到环境的 PATH 变量(在 MacOS 上)

unity-game-engine - 汽车运动统一

c# - 编写 Unity 后处理堆栈脚本

c# - 不能隐式转换类型 - 泛型

c# - 如何在指定打印机上使用 C# 设置打印机端口

c# - 如何重命名我的 c# 命名空间以包含一个点

c# - asp.net c# 检查错误

c# - 在WPF中保存控件的图像(屏幕截图) - MVVM模式