在Xamarin应用程序中,我使用了一个引用system.collection.Immutable的第三方库。在VS 2019中为Android构建应用程序时没有遇到任何问题。
当我尝试在VS2017中构建应用程序时,它显示以下构建错误
Error XA2002: Can not resolve reference: `System.Memory`, referenced by `System.Collections.Immutable`. Please add a NuGet package or assembly reference for `System.Memory`, or remove the reference to `System.Collections.Immutable`.在添加了对System.Memory的引用之后,错误就解决了。
请让我知道这背后的实际原因,因为目标android版本(Android 9.0 pie)在VS 2017和VS 2019上是相同的
发布于 2020-09-10 16:02:18
我认为这个问题的出现是因为Visual Studio2017和Visual Studio2019中的Xamarin SDK版本与System.Memory NuGet包版本之间存在微妙的兼容性关系。在Visual Studio2019中,Xamarin.Android和Xamarin.iOS使用自己的NuGet包中类型的内置实现,因此它们不需要引用NuGet包中的程序集。相应地,System.Memory NuGet包包含用于Xamarin项目类型的占位符文件,以防止冲突。
但是内置的实现还没有覆盖NuGet包的全部外围应用。因此,对于Visual Studio2017,Mono团队暂时隐藏了这些内置实现(通过将它们切换到内部并删除System.Memory外观组装)。这意味着Xamarin项目现在依赖于NuGet包中的实现。
https://stackoverflow.com/questions/63823869
复制相似问题