Xamarin + 统一国际奥委会
Xamarin + Unity IoC
我是 Xamarin Forms 的新手,我正在尝试将 Microsoft Unity IoC 框架集成到其中以用于 iOS/Android 应用程序。
添加 Nuget 包非常简单,但一旦我添加了实际引用 Unity 的内容(例如 public static UnityContainer Container { get; private set; }
),我的应用程序就会在 运行 时间死掉,并显示
但是,当我转到 运行 时,我的应用程序立即死掉,FileNotFoundException
为 Microsoft.Practices.ServicesLocation
我能告诉我的最好的项目是设置 similar to this tutorial project。
Unity 引用了 Common Service Locator,但 NuGet 包没有将其作为依赖项。我相信这是设计使然(但我现在找不到它的文档)。
通常这不是问题,除非使用 UnityServiceLocator,但它会给您带来问题。如果您手动安装 CommonServiceLocator NuGet Package 它将解决问题。
我是 Xamarin Forms 的新手,我正在尝试将 Microsoft Unity IoC 框架集成到其中以用于 iOS/Android 应用程序。
添加 Nuget 包非常简单,但一旦我添加了实际引用 Unity 的内容(例如 public static UnityContainer Container { get; private set; }
),我的应用程序就会在 运行 时间死掉,并显示
但是,当我转到 运行 时,我的应用程序立即死掉,FileNotFoundException
为 Microsoft.Practices.ServicesLocation
我能告诉我的最好的项目是设置 similar to this tutorial project。
Unity 引用了 Common Service Locator,但 NuGet 包没有将其作为依赖项。我相信这是设计使然(但我现在找不到它的文档)。
通常这不是问题,除非使用 UnityServiceLocator,但它会给您带来问题。如果您手动安装 CommonServiceLocator NuGet Package 它将解决问题。