locked
.net core (.net framework) mvc System.MissingMethodException RRS feed

  • Question

  • User-231970344 posted
    {
      "dependencies": {
        "Autofac": "4.6.0",
        "Autofac.Extensions.DependencyInjection": "4.1.0",
        "AutoMapper.Extensions.Microsoft.DependencyInjection": "2.0.1",
        "xx.Service.Core": "1.0.0-*",
        "Akka": "1.2.0",
        "Akka.Remote": "1.2.0",
        "System.Net.Http": "4.3.2",
        "DotNetty.Transport": "0.4.5",
        "DotNetty.Handlers": "0.4.5",
        "DotNetty.Codecs": "0.4.5",
        "DotNetty.Buffers": "0.4.5",
        "DotNetty.Common": "0.4.5",
        "Newtonsoft.Json": "10.0.2",
        "System.Diagnostics.DiagnosticSource": "4.3.1",
        "AutoMapper": "6.1.0",
        "Microsoft.EntityFrameworkCore.Relational": "1.1.2",
        "Microsoft.EntityFrameworkCore.SqlServer": "1.1.2",
        "Microsoft.EntityFrameworkCore.Tools": "1.1.1",
        "Microsoft.AspNetCore.Hosting": "1.1.2",
        "Microsoft.AspNetCore.Http.Abstractions": "1.1.2",
        "Microsoft.AspNetCore.Mvc.ViewFeatures": "1.1.3",
        "xx.Web.Core": "1.0.0-*",
        "Microsoft.Extensions.DependencyInjection": "2.0.0-preview1-final",
        "Microsoft.AspNetCore.Mvc": "1.1.3",
        "Microsoft.AspNetCore.Routing": "1.1.2",
        "Microsoft.AspNetCore.Server.IISIntegration": "1.1.2",
        "Microsoft.AspNetCore.Server.Kestrel": "1.1.2",
        "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
        "Microsoft.Extensions.Configuration.FileExtensions": "1.1.2",
        "Microsoft.Extensions.Configuration.Json": "1.1.2",
        "Microsoft.Extensions.Logging": "1.1.2",
        "Microsoft.Extensions.Logging.Console": "1.1.2",
        "Microsoft.Extensions.Logging.Debug": "1.1.2",
        "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.2",
        "Microsoft.EntityFrameworkCore": "1.1.2",
        "Microsoft.Extensions.Logging.Abstractions": "2.0.0-preview1-final",
        "Microsoft.Extensions.DependencyInjection.Abstractions": "2.0.0-preview1-final",
        "Microsoft.Extensions.Configuration": "2.0.0-preview1-final",
        "Microsoft.AspNetCore": "1.1.2"
      },
    
      "tools": {
        "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
      },
      "frameworks": {
        "net462": {
          "dependencies": {
            "xxx.Shared.Messages": {
              "target": "project"
            }
          }
        }
      },
      "buildOptions": {
        "emitEntryPoint": true,
        "preserveCompilationContext": true,
        "copyToOutput": {
          "include": [ "appsettings.json", "rawrabbit.json" ]
        }
      },
    
      "runtimeOptions": {
        "configProperties": {
          "System.GC.Server": true
        }
      },
    
      "publishOptions": {
        "include": [
          "wwwroot",
          "**/*.cshtml",
          "appsettings.json",
          "web.config",
          "rawrabbit.json"
        ]
      },
    
      "scripts": {
        "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
      }
      //,
      //"runtimes": {
      //  "win7-x64": {}
      //}
    }

     can't fix this error below. This is my package.config file.

    An unhandled exception of type 'System.MissingMethodException' occurred in xxx.exe.

    Additional information: Method not found: 'System.IServiceProvider Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(Microsoft.Extensions.DependencyInjection.IServiceCollection)'.

    Friday, June 16, 2017 1:24 AM

All replies

  • User1967761114 posted

    Hi serhanayse,

    I’m sure this exception occurred by the conflict version of packages.

    According to your packages.config, see the following dependency:

    "Microsoft.Extensions.DependencyInjection": "2.0.0-preview1-final",

    The package is using 2.0, and other packages are all 1.X.X .

    I suggest you could downgrade the version of "Microsoft.Extensions.DependencyInjection" to 1.1.1.

    Or you also upgrade all other .Net Core packages to 2.0, such as "Microsoft.EntityFrameworkCore.SqlServer","Microsoft.AspNetCore.Hosting","Microsoft.AspNetCore.MVC" and so on.

     

    If you have any other questions, please feel free to contact me any time.

    Best Regards

    Even

    Friday, June 16, 2017 5:29 AM
  • User-231970344 posted

    Hi Even,

    I did what you said.  But get this error now :

    An unhandled exception of type 'System.IO.FileLoadException' occurred in Unknown Module.

    Additional information: Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

    {
      "dependencies": {
        "Autofac": "4.6.0",
        "Autofac.Extensions.DependencyInjection": "4.1.0",
        "AutoMapper.Extensions.Microsoft.DependencyInjection": "2.0.1",
        "xx.Service.Core": "1.0.0-*",
        "Akka": "1.2.0",
        "Akka.Remote": "1.2.0",
        "System.Net.Http": "4.3.2",
        "DotNetty.Transport": "0.4.5",
        "DotNetty.Handlers": "0.4.5",
        "DotNetty.Codecs": "0.4.5",
        "DotNetty.Buffers": "0.4.5",
        "DotNetty.Common": "0.4.5",
        "Newtonsoft.Json": "10.0.2",
        "System.Diagnostics.DiagnosticSource": "4.3.1",
        "AutoMapper": "6.1.0",
        "Microsoft.EntityFrameworkCore.Relational": "1.1.2",
        "Microsoft.EntityFrameworkCore.SqlServer": "1.1.1",
        "Microsoft.AspNetCore.Hosting": "1.1.1",
        "Microsoft.AspNetCore.Http.Abstractions": "1.1.2",
        "Microsoft.AspNetCore.Mvc.ViewFeatures": "1.1.3",
        "xx.Web.Core": "1.0.0-*",
        "Microsoft.Extensions.DependencyInjection": "1.1.1",
        "Microsoft.AspNetCore.Mvc": "1.1.1",
        "Microsoft.AspNetCore.Routing": "1.1.2",
        "Microsoft.AspNetCore.Server.IISIntegration": "1.1.2",
        "Microsoft.AspNetCore.Server.Kestrel": "1.1.2",
        "Microsoft.Extensions.Configuration.FileExtensions": "1.1.2",
        "Microsoft.Extensions.Configuration.Json": "1.1.2",
        "Microsoft.Extensions.Logging": "1.1.2",
        "Microsoft.Extensions.Logging.Console": "1.1.2",
        "Microsoft.Extensions.Logging.Debug": "1.1.2",
        "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.2",
        "Microsoft.EntityFrameworkCore": "1.1.2",
        "Microsoft.Extensions.Logging.Abstractions": "1.1.2",
        "Microsoft.Extensions.DependencyInjection.Abstractions": "1.1.1",
        "Microsoft.Extensions.Configuration": "1.1.1",
        "Microsoft.AspNetCore": "1.1.2",
        "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0"
      },

    And this is my  xx.Web.Core project's project.json file. (It is added to my project as reference)

    "dependencies": {
        "xx.Model.Core": "1.0.0-*",
        "Microsoft.NETCore.Portable.Compatibility": "1.0.1",
        "System.Runtime.Serialization.Primitives": "4.3.0",
        "RawRabbit": "1.10.3",
        "RawRabbit.vNext": "1.10.3",
        "RawRabbit.DependencyInjection.Autofac": "1.10.3",
        "Microsoft.Extensions.Caching.Redis.Core": "1.0.3",
         "Autofac": "4.6.0",
        "Autofac.Extensions.DependencyInjection": "4.1.0",
        "Microsoft.AspNetCore": "1.1.2",
        "Microsoft.AspNetCore.Http.Abstractions": "1.1.2",
        "Microsoft.AspNetCore.Mvc": "1.1.1",
        "Microsoft.AspNetCore.Mvc.ViewFeatures": "1.1.3",
        "Microsoft.AspNetCore.StaticFiles": "1.1.2",
        "Microsoft.IdentityModel.Tokens": "5.1.4",
        "Newtonsoft.Json": "10.0.2",
        "RabbitMQ.Client": "4.1.3",
        "Swashbuckle.AspNetCore": "1.0.0",
        "Microsoft.Extensions.Caching.Redis": "1.1.1",
        "Microsoft.Extensions.DependencyInjection": "1.1.1"
      } "frameworks": 
    {
    "netstandard1.5":
    {
    "imports": "dnx462"
    }
    }



    Friday, June 16, 2017 8:37 AM
  • User1967761114 posted

    Hi serhanayse,

    I'm also unsure which package still dependency on the package of Microsoft.Extensions.Logging.Abstractions V2 :).

    I suggest you'd better try to make a new project, and install packages by NuGet.

     

    If you have any other questions, please feel free to contact me any time.

    Best Regards

    Even

    Friday, June 16, 2017 10:29 AM
  • User1120430333 posted

    Additional information: Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

    You are being told to the version of the DLL wanted right down to its PublicKeyToken of the DLL your application has reference to that is not there.

    https://www.nuget.org/packages/microsoft.extensions.logging.abstractions/

    You can use Nuget at the project level and go get the wanted version of the DLL.

    Sunday, June 18, 2017 9:00 PM