Ninject 和 windows phone 8.1

Ninject and windows phone 8.1

我的 Windows Phone 8.1 应用在尝试添加 Ninject 时遇到了一些问题。

当我实例化一个新的StandardKernel时,我有一个System.IO.FileNotFoundException(似乎异常发生在Ninject.dll)。这是异常的完整消息:

Exception = {System.IO.FileNotFoundException: Could not load file or assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified. File name: 'System.Core, Version=4.0.0...

我尝试了几个版本的 Ninject:

  1. v2.0.1:在 NuGet 中找到(这是我能够安装的最高版本,当尝试从 NuGet 安装 v3.2.0 时安装失败)
  2. v3.2.0:发现于 ninject.org。我拿的是.NET 4版本。

除了上面显示的例外情况,两者都给了我相同的结果。

在此先感谢您的帮助。

托马斯

尝试 https://github.com/remogloor/ninject 上提供的 WinRT 分支,因为据我所知没有正式的 Ninject 用于 WinRT。

如果您正在寻找一个一体化的解决方案,Caliburn Micro MVVM 框架还包含一个简单的 IoC 容器,它易于使用。

Unity 也可用于 Winrt。