This post shows you how to fix 'DbContextOptionsBuilder' does not contain a definition for 'UseSqlServer' and no accessible extension method 'UseSqlServer'.

Error

Severity Code Description Project File Line Suppression State

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

To solve the problem you can right click on your project, then select Manage Nuget Packages, finally install it.

PM > Install-Package Microsoft.EntityFrameworkCore.SqlServer

to your ASP.Net Core project,