Reputation: 489
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)'.'
Upvotes: 7
Views: 19831
Reputation: 21
I also experienced this error with Microsoft.AspNet.OData version 7.5.17 and downgrading to 7.5.14 resolved this error.
Upvotes: 0
Reputation: 494
If you use Microsoft.AspNet.OData, this error occurs from NuGet version 7.5.15 and above. Downgrading to 7.5.14 may resolve this issue.
Upvotes: 5
Reputation: 388
For .NET Core 3.1, for some reason Visual Studio wasn't giving me the hint that I need to add using Microsoft.Extensions.DependencyInjection;
. Manually adding that fixed it for me.
Upvotes: 3
Reputation: 3964
I had similar issue when using Sql nuget and upgrading that fixed the issue.
IDbContextFactory
had to be changed to IDesignTimeDbContextFactory
Upvotes: 1
Reputation: 61
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
Upvotes: 6
Reputation: 489
Downgrade package ApplicationInsights to version 1.1.2 from 2.0 solved
Upvotes: 3