Hosting icon indicating copy to clipboard operation
Hosting copied to clipboard

Microsoft.Extensions.DependencyInjection\1.0.0-rc2-15877 being loaded and causing Method not found :AddInstance

Open Kwirirai opened this issue 10 years ago • 3 comments

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",

Kwirirai avatar Jan 26 '16 17:01 Kwirirai

Can you share your whole project.json? You should not mix RC1 and RC2 packages due to breaking changes.

Tratcher avatar Jan 26 '16 18:01 Tratcher

{
  "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"
  }
}

Kwirirai avatar Jan 26 '16 18:01 Kwirirai

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

Kwirirai avatar Jan 26 '16 18:01 Kwirirai