I'm migrating a solution built with .NET Core SDK 1.0.0-preview2-1-003177 because I want to use it in Visual Studio 2017. I use the dotnet migrate command from .NET Core SDK 1.0.1, it goes well, it compiles. When I run the web part with IIS Express the classic Program.cs containing
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
crashes at Build() with this exception
System.MissingMethodException: 'Method not found: 'System.IServiceProvider Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(Microsoft.Extensions.DependencyInjection.IServiceCollection)'.'
I can't find the reason at all.
It looks like some of your dependencies, not updated to the right version. It can be old version or new version. You can create a new project ( dotnet new ) and validate the packages version on your csproj file. 99% of the error cause by version mismatch.
This happened for me because I was over eager and installed too many EntityFrameworkCore packages.
I had
Microsoft.EntityFrameworkCore 2.0.0-preview1-final
Microsoft.EntityFrameworkCore.SqlServer 1.1.2
I removed the first one so I was left with
Microsoft.EntityFrameworkCore.SqlServer 1.1.2
And then the error disappeared.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With