19

Just upgraded to asp.net core 2.1 and it seems like UseSqlServer no longer exists in the options for AddDbContext. (where I pass in the connectionstring)

What am I supposed to use instead?

1

2 Answers 2

40

Added nuget package Microsoft.EntityFrameworkCore.SqlServer and it worked again

10

You must add

using Microsoft.EntityFrameworkCore;

as explained in https://social.msdn.microsoft.com/Forums/en-US/f9cdb8de-0c4c-47ae-b0be-e4b52a887183/dbcontextoptionsbuilder-does-not-contain-a-definition-for-usesqlserver?forum=adodotnetentityframework

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.