我是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。
答案 0 :(得分:1)
Unity引用了Common Service Locator,但NuGet包没有将它作为依赖项。我相信这是设计的(但我现在无法找到它)。
除非使用UnityServiceLocator,否则通常这不是问题,但它会给您带来问题。如果您手动安装CommonServiceLocator NuGet Package,它将解决问题。