C# StructureMap无法加载文件或程序集
我正在WebAPI项目中使用StructureMap MVC。C# StructureMap无法加载文件或程序集,c#,asp.net-mvc,asp.net-web-api,structuremap,xunit,C#,Asp.net Mvc,Asp.net Web Api,Structuremap,Xunit,我正在WebAPI项目中使用StructureMap MVC。 当我运行单元测试或集成测试时,使用xUnit和ReSharper,我得到: System.IO.FileNotFoundException Could not load file or assembly 'MyApi.MyServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system
当我运行单元测试或集成测试时,使用xUnit和ReSharper,我得到:
System.IO.FileNotFoundException
Could not load file or assembly 'MyApi.MyServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the path specified.
这在我的测试中是随机发生的。当我再次尝试运行时,没有出现此错误
以下是发生错误的地方:
ObjectFactory.Initialize(x =>
{
x.For<IProvider>().LifecycleIs(Lifecycles.GetLifecycle(InstanceScope.PerRequest)).Use<SQLiteProvider>();
x.For<ILog>().LifecycleIs(Lifecycles.GetLifecycle(InstanceScope.Singleton)).Use(Logger.Object);
x.For<ISession>().LifecycleIs(Lifecycles.GetLifecycle(InstanceScope.PerRequest)).Use(() => Session);
});
您正在使用ReSharper 8吗?xunit runner有一个看起来像这样的讨厌的bug。确保将xunit扩展(ReSharper->extensionmanager)更新为1.2
at StructureMap.ObjectFactory.Initialize(Action`1 action) in c:\BuildAgent\work\767273992e840853\src\StructureMap\ObjectFactory.cs: line 61