我承认我是 Xamarin 和跨平台开发的新手,所以如果这看起来是一个微不足道的问题,我深表歉意,但我已经花了几个晚上试图弄清楚它的真相。
我有一个基本的 Xamarin Forms 应用程序,它在 Windows 8.1、Windows UWP 和 Android 中运行。它使用 SkiaSharp 来处理一些基本图形(基于 Skia 示例)。
它在所有三个平台上运行,但我必须删除 Xamarin 包并将其重新添加到项目中,并且我无法让 SkiaSharp 在 Windows 或 Android 中正常运行。我收到 BadImageFormatException:
Additional information: Could not load file or assembly 'SkiaSharp, Version=1.56.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)
我在 Windows 8.1 版本的 x86、x64 和任何 CPU 配置以及 Android 版本中遇到此异常。
如果我运行 UWP 项目,它会完美运行。
相关项目结构: …