Microsoft.Extensions.DependencyInjection\1.0.0-rc2-15877 being loaded and causing Method not found :AddInstance
I am trying to do integration tests using Microsoft.AspNet.TestHost which uses the Microsoft.AspNet.Hosting package, and I am getting this error:
Method not found: 'Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions.AddInstance(Microsoft.Extensions.DependencyInjection.IServiceCollection, !!0) Under debug its loading Microsoft.Extensions.DependencyInjection\1.0.0-rc2-15877 which is the older version. I am not sure what I am doing wrong: var _server = new TestServer(TestServer.CreateBuilder().UseStartup< Foo.FrontEnd.Startup>()); my packages :
"Microsoft.AspNet.TestHost": "1.0.0-rc1-final", "Microsoft.AspNet.Http.Abstractions": "1.0.0-rc1-final",
Can you share your whole project.json? You should not mix RC1 and RC2 packages due to breaking changes.
{
"version": "1.0.0-*",
"description": "VideoStore.Tests Class Library",
"authors": [ "kwiri" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"frameworks": {
"dnx451": {
"dependencies": {
"Moq": "4.2.1312.1622",
"xunit": "2.1.0-rc2-build3176",
"xunit.runner.dnx": "2.1.0-rc1-build204",
"FluentAssertions": "4.2.1",
"Microsoft.AspNet.TestHost": "1.0.0-rc1-final",
"Microsoft.AspNet.Http.Abstractions": "1.0.0-rc1-final",
"Microsoft.AspNet.Hosting": "1.0.0-rc1-final"
}
}
},
"dependencies": {
"Foo.FrontEnd": "1.0.0-*",
"Foo.Security": "1.0.0-*"
},
"commands": {
"test": "xunit.runner.dnx"
}
}
Thanks about the part mixing rc2 qnd rc1 seems to be an issue with entity framework I had EntityFramework.MicrosoftSqlServer with rc2 something changed it to 7.0.0-rc1-final .Its not an issue with Microsoft.AspNet.Hosting