Method not found: 'System.IServiceProvider Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider'

10,281

Solution 1

Downgrade package ApplicationInsights to version 1.1.2 from 2.0 solved

Solution 2

I've just come across this issue using aspnet core 2.0, in my case upgrading the other default packages (AspNetCore, AspNetCore.Mvc, NetCore.App) to 2.0 did the trick, despite installing 2.0 the packages (apart from App insights) were 1.1.x initially

Solution 3

I had similar issue when using Sql nuget and upgrading that fixed the issue.

IDbContextFactory had to be changed to IDesignTimeDbContextFactory

Share:
10,281
Daniel Rusnok
Author by

Daniel Rusnok

Updated on June 13, 2022

Comments

  • Daniel Rusnok
    Daniel Rusnok about 2 years

    In my Main method of .net Core app Iam getting this error and I dunno where should I look for solution.

    this is my main method:

     public static void Main(string[] args)
        {
            var host = new WebHostBuilder()
                .UseKestrel()
                .UseContentRoot(Directory.GetCurrentDirectory())
                .UseIISIntegration()
                .UseStartup<Startup>()
                .UseApplicationInsights()
                .Build();
    
            host.Run();
        }
    

    This is error message I am getting when hit F5 to fire project:

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