我正在尝试使用Microsoft.AspNet.TestHost进行集成测试,它使用Microsoft.AspNet.Hosting包,我收到此错误:
找不到方法: “Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions.AddInstance(Microsoft.Extensions.DependencyInjection.IServiceCollection, !! 0)
在调试其加载Microsoft.Extensions.DependencyInjection\1.0.0-rc2-15877
这是旧版本。我不确定我做错了什么:
var _server = new TestServer(TestServer.CreateBuilder().UseStartup< Foo.FrontEnd.Startup>());
我的包裹:
"Microsoft.AspNet.TestHost": "1.0.0-rc1-final",
"Microsoft.AspNet.Http.Abstractions": "1.0.0-rc1-final",