【发布时间】:2014-06-06 21:28:18
【问题描述】:
我正在尝试将 Castle.Windsor 包含在 Xamarin 3.0 项目和将在项目中使用的可移植类库中。当我尝试通过 nuget 包含此内容时,出现以下错误
PM> install-package castle.Windsor
Attempting to resolve dependency 'Castle.Core (≥ 3.3.0)'.
Installing 'Castle.Core 3.3.0'.
Successfully installed 'Castle.Core 3.3.0'.
Installing 'Castle.Windsor 3.3.0'.
Successfully installed 'Castle.Windsor 3.3.0'.
Adding 'Castle.Core 3.3.0' to FuelCog.Core.CompositionRoot.
Uninstalling 'Castle.Core 3.3.0'.
Successfully uninstalled 'Castle.Core 3.3.0'.
Install failed. Rolling back...
install-package : Could not install package 'Castle.Core 3.3.0'. You are trying to install this package into a project that targets 'portable-net45+sl50+win+wp80+MonoAndroid10+MonoTouch10',
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.
At line:1 char:1
+ install-package castle.Windsor
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
我的目标是 Xamarin.Android、Xamarin.iOS 和 Windows Phone 8.0。根据SO answer,Castle.Windsor 使用 Mono 框架。我试图禁用 PCL 属性中的各种目标,以查看哪个目标不允许 Castle.Windsor 正确安装,但似乎没有选择有效。
Castle.Windsor 不能与 PCL 一起使用还是我遗漏了什么?
【问题讨论】:
-
不兼容 PCL。对于 DI,你可以使用 TinyIOC、SimpleContainer 等。我已经抽象了我的解析器类,所以我可以在不同的平台上使用不同的容器。
标签: c# mono xamarin castle-windsor nuget-package