【发布时间】:2014-05-11 15:24:36
【问题描述】:
我正在制作一个 Windows Phone 8 应用程序,但是因为我想在某个时候也为 Windows 8.1 商店发布这个应用程序,所以我努力将应用程序逻辑分解到一个可移植类库中。到目前为止一切顺利。
现在作为一个好孩子,我想使用 IoC 容器,按偏好统一(因为我在桌面和仅限 Win Phone 8 的应用程序中熟悉它)
所以这是我的问题; NuGet Unity 包不会安装到我的便携式应用程序中,结果如下:
Installing 'Unity 3.0.1304.1'.
Successfully installed 'Unity 3.0.1304.1'.
Adding 'Unity 3.0.1304.1' to Logic.
Uninstalling 'Unity 3.0.1304.1'.
Successfully uninstalled 'Unity 3.0.1304.1'.
Install failed. Rolling back...
Could not install package 'Unity 3.0.1304.1'. You are trying to install this package into a
project that targets 'portable-net45+wp80+win', 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.
那么,是否存在与 PCL 一起使用的统一体?还是这只是 NuGet 包的一个缺点?
我未能在 P&P website 上找到任何有用的文档来说明它与哪些平台兼容,但我知道它至少支持 WP8,因为 NuGet 包对针对此的库非常满意。
欢迎社区提供任何指导如果可以避免的话,我不想放弃在我的应用程序逻辑中使用 PCL,但如果它归结为为了保持 NuGet 的优点,我将使用 NuGet 进行包管理。
这可能与NuGet and Portable Class Libraries - Package doesn't target any framework 有关吗?这似乎与制作您自己的 NuGet 包以在您自己的 PCL 中使用更相关。
【问题讨论】:
-
我认为这是您项目中的一个问题,因为我可以将 Unity 与针对 WP 8 的 PCL 一起使用。刚才在我的 NuGet 控制台中:“成功安装了 'Unity 3.0.1304.1'”你不是在主应用程序中使用 Unity 吗?
-
我在主要的 WP8 项目中有统一,它只是由于某种原因拒绝添加引用的 PCL。你的回复还是给了我希望,我会围绕项目设置来看看我是否能解决这个问题。
标签: windows-phone-8 unity-container nuget portable-class-library