Simon Leung
asked on
donet ef migration errors
Try to run dotnet ef migration but fails. Any idea ?
C:\Projects\slivrr>dotnet add package Microsoft.EntityFrameworkCore --version 3.0.0-preview.18572.1
Writing C:\Users\tonyleung.abc\AppData\Local\Temp\tmp6309.tmp
info : Adding PackageReference for package 'Microsoft.EntityFrameworkCore' into project 'C:\Projects\slivrr\slivrr.csproj'.
info : Restoring packages for C:\Projects\slivrr\slivrr.csproj...
info : Package 'Microsoft.EntityFrameworkCore' is compatible with all the specified frameworks in project 'C:\Projects\slivrr\slivrr.csproj'.
info : PackageReference for package 'Microsoft.EntityFrameworkCore' version '3.0.0-preview.18572.1' updated in file 'C:\Projects\slivrr\slivrr.csproj'.
info : Committing restore...
info : Writing assets file to disk. Path: C:\Projects\slivrr\obj\project.assets.json
log : Restore completed in 220.26 ms for C:\Projects\slivrr\slivrr.csproj.
C:\Projects\slivrr>dotnet add package Microsoft.EntityFrameworkCore.Design --version 3.0.0-preview.18572.1
Writing C:\Users\tonyleung.abc\AppData\Local\Temp\tmpAF16.tmp
info : Adding PackageReference for package 'Microsoft.EntityFrameworkCore.Design' into project 'C:\Projects\slivrr\slivrr.csproj'.
info : Restoring packages for C:\Projects\slivrr\slivrr.csproj...
info : Package 'Microsoft.EntityFrameworkCore.Design' is compatible with all the specified frameworks in project 'C:\Projects\slivrr\slivrr.csproj'.
info : PackageReference for package 'Microsoft.EntityFrameworkCore.Design' version '3.0.0-preview.18572.1' updated in file 'C:\Projects\slivrr\slivrr.csproj'.
info : Committing restore...
info : Assets file has not changed. Skipping assets file writing. Path: C:\Projects\slivrr\obj\project.assets.json
log : Restore completed in 167.02 ms for C:\Projects\slivrr\slivrr.csproj.
C:\Projects\slivrr>dotnet add package Microsoft.EntityFrameworkCore.SqlServer --version 3.0.0-preview.18572.1
Writing C:\Users\tonyleung.abc\AppData\Local\Temp\tmpF21A.tmp
info : Adding PackageReference for package 'Microsoft.EntityFrameworkCore.SqlServer' into project 'C:\Projects\slivrr\slivrr.csproj'.
info : Restoring packages for C:\Projects\slivrr\slivrr.csproj...
info : Package 'Microsoft.EntityFrameworkCore.SqlServer' is compatible with all the specified frameworks in project 'C:\Projects\slivrr\slivrr.csproj'.
info : PackageReference for package 'Microsoft.EntityFrameworkCore.SqlServer' version '3.0.0-preview.18572.1' updated in file 'C:\Projects\slivrr\slivrr.csproj'.
info : Committing restore...
info : Assets file has not changed. Skipping assets file writing. Path: C:\Projects\slivrr\obj\project.assets.json
log : Restore completed in 168.01 ms for C:\Projects\slivrr\slivrr.csproj.
C:\Projects\slivrr>dotnet ef migrations add InitialCreate
System.MissingMethodException: Method not found: 'System.Text.Json.JsonDocument System.Text.Json.JsonDocument.Parse(System.IO.Stream, System.Text.Json.JsonReaderOptions)'.
at Microsoft.EntityFrameworkCore.Tools.RootCommand.Execute()
at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.<Configure>b__0()
at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
Method not found: 'System.Text.Json.JsonDocument System.Text.Json.JsonDocument.Parse(System.IO.Stream, System.Text.Json.JsonReaderOptions)'.
Have you added/referenced the Namespace: System.Text.Json. Refer to JsonDocument.Parse Method
ASKER
Modify the code and still return an error.
System.InvalidOperationExc eption: No database provider has been configured for this DbContext. A provider can be configured by overriding the DbContext.OnConfiguring method or by using AddDbContext on the application service provider. If AddDbContext is used, then also ensure that your DbContext type accepts a DbContextOptions<TContext> object in its constructor and passes it to the base constructor for DbContext.
TimepieceContext.cs
Startup.cs
System.InvalidOperationExc
TimepieceContext.cs
Startup.cs
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
https://stackoverflow.com/questions/55974734/ef-core-tools-not-working-on-dotnet-core-3-preview-4
Fixed it through the attached link. Thx for response and information.
Fixed it through the attached link. Thx for response and information.