I add the following to my startup.cs file and get the following error located below.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
services.AddDbContext<MvcMovieContext>(options =>
options.UseSqlite("Data Source=MvcMovie.db"));
}
'DbContextOptionsBuilder' does not contain a definition for 'UseSqlite' and no extension method 'UseSqlite' accepting a first argument of type 'DbContextOptionsBuilder' could be found (are you missing a using directive or an assembly reference?)
Along with the terminal error:
Startup.cs(40,27): error CS1061: 'DbContextOptionsBuilder' does not contain a definition for 'UseSqlite' and no extension method 'UseSqlite' accepting a first argument of type 'DbContextOptionsBuilder' could be found (are you missing ausing directive or an assembly reference?)
Looking around online doesn't quite help for this particular issue.
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
I had a similar issue that was resolved by modifying the MvcMovie.csproj file. I replaced
<PackageReference Include="Microsoft.AspNetCore.App" />
with
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.0" />
The documentation references the Microsoft.AspNetCore.All package but the template used to generate the project uses Microsoft.AspNetCore.App. Some of the differences in the dependent packages that are loaded by All but not by App are packages related to Sqlite.
@zarthur We strongly recommend you not use M.A.All. You're better off using "Microsoft.AspNetCore.App" with the current version.
@jball5 UseSqlite is not in M.A.App, that's why you got that error. You need to explicitly add it. See https://docs.microsoft.com/en-us/aspnet/core/fundamentals/metapackage?view=aspnetcore-2.1#migrating-from-microsoftaspnetcoreall-to-microsoftaspnetcoreapp
Also appears in https://github.com/aspnet/Docs/blob/master/aspnetcore/tutorials/razor-pages-vsc/model.md
See: Razor page Tutorial doesn't tell user to install the SQLite provider #7516
I managed to fix this issue by installing Microsoft.EntityFrameworkCore.Sqlite 2.1.1
dotnet add [filepath] package Microsoft.EntityFrameworkCore.Sqlite --version 2.1.1Hope this helps

This worked for me
This was fixed in the 2.2 unification.
Most helpful comment
I managed to fix this issue by installing Microsoft.EntityFrameworkCore.Sqlite 2.1.1
dotnet add [filepath] package Microsoft.EntityFrameworkCore.Sqlite --version 2.1.1Hope this helps