安装 Ninject 时,我从 VS2015 的输出中获取此日志:
Attempting to gather dependencies information for package 'Ninject.3.2.2' with respect to project 'ProjectPhoenix.Droid', targeting 'MonoAndroid,Version=v5.1'
Attempting to resolve dependencies for package 'Ninject.3.2.2' with DependencyBehavior 'Lowest'
Resolving actions to install package 'Ninject.3.2.2'
Resolved actions to install package 'Ninject.3.2.2'
Attempting to gather dependencies information for package 'Ninject.3.2.2' with respect to project 'ProjectPhoenix.iOS', targeting 'Xamarin.iOS,Version=v1.0'
Attempting to resolve dependencies for package 'Ninject.3.2.2' with DependencyBehavior 'Lowest'
Resolving actions to install package 'Ninject.3.2.2'
Resolved actions to install package 'Ninject.3.2.2'
For adding package 'Ninject.3.2.2' to project 'ProjectPhoenix.Droid' that targets 'monoandroid51'.
Install failed. Rolling back...
Package 'Ninject 3.2.2.0' does not exist in project 'ProjectPhoenix.Droid'
Could not install package 'Ninject 3.2.2'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v5.1', 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.
========== Finished ==========
我正在开发 Xamarin,同一项目在 Xamarin Studio 和 Visual Studio 2015 的其他实例上运行良好,因此我知道这不是代码问题,而是我的配置问题。
最佳答案
我相信您所问的问题已在另一个问题中得到解答:
How come there's no IKernel implementation in Ninject.Portable
Ninject 需要特定于平台的代码才能在每个 Xamarin 平台上工作,因此,对于 Xamarin 项目,我建议您使用 Ninject.Portable NuGet 包而不是普通的 Ninject 包。您还需要在 Droid、iOS、Tests 和 UITests 项目中安装 NuGet,以便能够编译所有解决方案。
最诚挚的问候
关于visual-studio - 如果我的项目面向 MonoAndroid,Version=v5.1,为什么无法安装 Ninject 3.2.2?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32910301/