简体   繁体   English

无法将ZXing.Net.Mobile程序包添加到我的Xamarin.Forms项目中

[英]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. 我有一个Xamarin.Forms项目,我想在其中使用ZXing库进行条形码扫描。 However I am unable to install package ZXing.Net.Mobile and ZXing.Net.Mobile.Forms into my portable project. 但是,我无法将软件包ZXing.Net.Mobile和ZXing.Net.Mobile.Forms安装到我的便携式项目中。 The exception I keep getting is as follows: 我不断得到的异常如下:

Could not install package 'ZXing.Net.Mobile 2.0.4.46'. 无法安装软件包“ 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. 您正在尝试将此程序包安装到以'.NETPortable,Version = v4.5,Profile = Profile111'为目标的项目中,但是该程序包不包含任何与该框架兼容的程序集引用或内容文件。 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. 我快速浏览了软件包的内容,但根据文件夹名称,该软件包并未完全针对PCL Profile 111(.NET Framework 4.5,Windows 8,Windows Phone 8.1)。 The portable library is located in the folder: 可移植库位于以下文件夹中:

lib/portable-net45+netcore45+wp8+UAP10.0+MonoAndroid403+MonoTouch10+Xamarin.iOS10 lib /便携式-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. 缺少与PCL配置文件111兼容的wpa81 (即Windows Phone 8.1 -Silverlight)。

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. 由于文件夹名称包含netcore45UAP10.0 ,我怀疑缺少的wpa81规范只是软件包作者的疏忽,可以毫无问题地添加到文件夹名称中。 Of course, this has to be confirmed with the package authors, and they would need to update the NuGet package. 当然,这必须由软件包作者确认,并且他们需要更新NuGet软件包。

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. 为了获得最大的兼容性,我认为最好排除UAP和Xamarin规范。 NuGet targets these platforms automatically if standard lib folder naming conventions are used. 如果使用标准的 lib文件夹命名约定,则NuGet会自动将这些平台作为目标。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM