Build Failed problem EFCore- scaffolding Scaffold occurred ultimate solution

You should encounter while using EntityFrameworkCore of DBFirst scaffolding (Scaffolding) through the Build Failed error, without any prompting, I have encountered a lot of times, has the perfect solution for everyone to share and investigation methods:

(1) To use scaffolding for the project, we must first ensure that the project is compiled normally run, compiled in VisualStudio the Ctrl + Shift + B, if error, the first deal.

(2) ensure that the relevant reference EntityFrameWork package complete and correct, I use the following version:

  Microsoft.EntityFrameworkCore.Design(2.1.8)

  Microsoft.EntityFrameworkCore.Tools(2.1.8)

  Microsoft.EntityFrameworkCore.SqlServer(2.1.8)

(3) open error scaffold command line to run, so we can find the problem:

  dotnet ef dbcontext scaffold "connect string" -o Microsoft.EntityFrameworkCore.SqlServer the DefaultContext the Model -C -f -v

       The final -v command is to open the error, run the command line will be prompted if an error is found

(4) I met the wrong reasons:

  1, resulting in the issue of interdependence between projects, you can try to cancel references to each other and run

       2, suggesting that "C # 7.0 does not support" the default text. "Use language version 7.1 or higher.", Probably because your solution appeared different versions of .Net (such as .NetStandard and .NetFramework common appear in the same solution). Then just add configuration items in the project file can be solved:
  <PropertyGroup>
    <langversion> Latest </ langversion>
  </ PropertyGroup>

Or set in the "Project Properties> Build> Advanced> Language Version" in the can

Guess you like

Origin www.cnblogs.com/cdoneiX/p/12236970.html