【发布时间】:2015-12-16 03:11:38
【问题描述】:
我想在 Windows 10 通用 Windows 平台应用程序和 Windows Phone 8.1 应用程序之间共享我的 M2MQTT 代码。将来可能是 WPF 应用程序。
我尝试使用 NuGet 将 M2MQTT 包含在可移植类库 (PCL) 中。我将 PCL 的目标定为满足这两种项目类型的最低要求。我收到以下错误。是否可以在 UWP 和 WP8.1 项目都可以共享的可移植类库中引用 m2mqtt?
Attempting to gather dependencies information for package 'M2Mqtt.4.2.0.1' with respect to project 'Pcl45', targeting '.NETPortable,Version=v4.6,Profile=Profile32'
Attempting to resolve dependencies for package 'M2Mqtt.4.2.0.1' with DependencyBehavior 'Lowest'
Resolving actions to install package 'M2Mqtt.4.2.0.1'
Resolved actions to install package 'M2Mqtt.4.2.0.1'
Install failed. Rolling back...
Package 'M2Mqtt 4.2.0.1' does not exist in project 'Pcl45'
Could not install package 'M2Mqtt 4.2.0.1'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.6,Profile=Profile32', 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.
附加信息 2015 年 9 月 24 日
我克隆了 M2MQTT GitHub repository 并注意到有一个适用于 Windows 8.1 和 Windows phone 8.1 的 .pcl。不过,我没有在 .pcl 中看到对 UWP 的支持。
我想我有我的答案。 No M2MQTT 在 UWP 项目中不支持 .pcl。
想知道将来是否有计划添加 .pcl 支持?
如果我可以在 Xamarin Android 或 Ios 项目中使用 M2MQTT?
附加信息 2015 年 9 月 28 日 根据@Anders Gustafsson 的建议,我成功创建了一个 .pcl,我可以在我的 UWP 应用程序和 windows phone 8.1 应用程序中使用它。不再重复代码。好的。希望这将适用于 xamarin android 和 ios。
有这个警告。
Severity Code Description Project File Line Source Warning
Some NuGet packages were installed using a target framework different from
the current target framework and may need to be reinstalled. Visit
http://docs.nuget.org/docs/workflows/reinstalling-packages for more
information. Packages affected: M2Mqtt Pcl45 0 Build
【问题讨论】:
标签: wpf xamarin windows-phone-8.1 portable-class-library uwp