自动映射器已失去 pcl 兼容性



我在 PCL 中使用自动映射程序 3 年了,一切正常。

但是从版本4.2.1开始,当我尝试将其安装在PCL中时,出现以下错误:

Could not install package 'AutoMapper 4.2.1'. 
You are trying to install this package into a project that targets
'portable-net45+win+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10',
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.

我错过了什么新东西吗?

谢谢大家

AutoMapper 4.2.1 不支持 Windows Phone 8 (wp80)。这里wp80是基于Silverlight的Windows Phone目标框架。因此,可移植类库项目的配置文件不兼容。查看自动映射器 4.2.1,NuGet 包的 PCL 目录为:

portable-net45+win+wpa81+MonoAndroid10+Xamarin.iOS10+MonoTouch10

Xamarin 和 Mono 框架是可选的,因此 PCL 配置文件基本上是:

net45+win+wpa81

因此,这是一个支持.NET 4.5,Windows 8和Windows Phone Applications 8.1的配置文件。这里wpa81是基于WinRT的Windows Phone目标框架。此 PCL 配置文件似乎是配置文件 111。

因此,为了使用AutoMapper 4.2.1,您需要更改PCL项目的配置文件。您当前的个人资料似乎是 Profile78。如果您切换到配置文件111或其他兼容的配置文件,那么您应该能够安装自动映射程序4.2.1。

或者,您可以使用旧版本的自动映射程序。自动映射器 4.1.0 目标:

net45+win+wpa81+wp8+MonoAndroid10+Xamarin.iOS10+MonoTouch10

它支持配置文件78。因此,看起来最新的AutoMapper已经放弃了对Windows Phone 8(Silverlight)的支持。

最新更新