combining .NET Core 2.2 and 3.0 projects

.net-core entity-framework-core

Question

I have two .NET unrelated projects. One is a Model (v. 2.2) and another is Web application (v. 3.0.0-preview7). I didn't have the problem with preview5, but now I have trouble running migrations against 2.2 project.

C:\>dotnet ef --help
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)'.

As I said, with preview5 I don't have any problem. Is it something that changed between 5 and 7, and I need to make some corresponding changes? I didn't see anything in the release notes. Or it is simply a bug, and I just need to wait until next preview?

I don't get any errors on dotnet build or dotnet run; only on dotnet ef commands

1
3
8/4/2019 11:46:01 PM

Accepted Answer

For me the solution was to create a global.json file with the following content:

{
   "sdk": {
      "version": "2.2.402"
   }
}

as explained in Microsoft docs

0
10/5/2019 7:26:33 AM

Popular Answer

Okey, so I found the solution problem was that dotnet ef --version was not preview 7 in my case it was preview 6 so i updated dotnet tool update --global dotnet-ef --version 3.0.0-preview7.19362.6 and now it works.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow