Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a ASP .Net Core 1.1 application which worked up till 2 weeks ago. I opened the application today and get the following errors.

'WebHostBuilder' does not contain a definition for 'UseKestrel' and no extension method 'UseKestrel' accepting a first argument of type 'WebHostBuilder' could be found (are you missing a using directive or an assembly reference?)

And

'DbContextOptionsBuilder' does not contain a definition for 'UseSqlServer' and no extension method 'UseSqlServer' accepting a first argument of type 'DbContextOptionsBuilder' could be found (are you missing a using directive or an assembly reference?)

I have been on Google, the whole day and still do not have a resolution.
Please Assist.

What I have tried:

Adding the NuGet packages again.
Posted
Updated 14-Aug-17 5:33am

1 solution

Without you actually telling what you've tried (unless reinstalling nuget is truly all you've done) I'll take a stab at it. A quick google search looks like your issue for DbContextOptionsBuilder is missing the Microsoft.EntityFrameworkCore.SqlServer reference.

'DbContextOptionsBuilder' does not contain a definition for 'UseSqlServer' and no extension method 'UseSqlServer' accepting a first argument of type ' - Google Search[^]

UseSqlServer() method is missing from Microsoft.EntityFrameworkCore.SqlServer 1.1.1 · Issue #7891 · aspnet/EntityFramework · GitHub[^]

The kestrel issue looks like you may need to make sure your projects.json file has the correct version of kestrel reference.

Asp.net core hello world on ubuntu 16.04 - Stack Overflow[^]

If you swear up and down that you've reinstalled your references and have the kestrel/sql server then you need to check your versions and make sure you don't have version mismatches. For example, your app is .net core 1.1 and is looking for all versions at 1.1 but when you've installed/reinstalled your sql server/kestrel references may be at 2.0 and you either need to upgrade everything to same version, or down grade the sql server/kestrel references to 1.1.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900