简体   繁体   中英

Unable to add ZXing.Net.Mobile package to my Xamarin.Forms project

I have an Xamarin.Forms project in which I want to use ZXing library for barcode scanning. However I am unable to install package ZXing.Net.Mobile and ZXing.Net.Mobile.Forms into my portable project. The exception I keep getting is as follows:

Could not install package 'ZXing.Net.Mobile 2.0.4.46'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile111', 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.

Any ideas on how to solve this?

I took a quick look at the package contents, and the package is not completely targeting PCL Profile 111 (.NET Framework 4.5, Windows 8, Windows Phone 8.1) according to the folder name. The portable library is located in the folder:

lib/portable-net45+netcore45+wp8+UAP10.0+MonoAndroid403+MonoTouch10+Xamarin.iOS10

which is missing out wpa81 (ie Windows Phone 8.1 non -Silverlight) to be compatible with PCL Profile 111.

Since netcore45 and UAP10.0 are included in the folder name, I suspect that the missing wpa81 specification is just an oversight by the package authors and could be added to the folder name without problems. Of course, this has to be confirmed with the package authors, and they would need to update the NuGet package.

As a side note, I also believe the folder name is a little bit "overdone". For maximum compatibility, I think it would be better to exclude the UAP and Xamarin specifications. NuGet targets these platforms automatically if standard lib folder naming conventions are used.

根据上面的Denis Vitez注释,如果不需要Windows Phone 8.1,则更改为Profile 7即可安装ZXing.Net.Mobile和ZXing.Net.Mobile.Forms。

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