I am running Scaffold-DbContext "Server=XXX;Database=XXX;User id=XXX;password=XXX" Microsoft.EntityFrameworkCore.SqlServer -OutputDir XXX
and no model is getting created. I have previously run this script on this computer, project, and database and the model has been created.
The packages that I have installed are :
Microsoft.EntityFrameworkCore.SqlServer (2.0.1),
Microsoft.EntityFrameworkCore.Tools (2.0.1), and
Microsoft.VisualStudio.Web.CodeGeneration.Design (2.0.1)
If I run this script on a different computer but in the same project and database it runs and completes building the model for the database.
When I run this command with -verbose
it returns:
Using project 'XXX'.
Using startup project 'XXX'.
Build started...
Build succeeded.
Is there a reason that this would stop working?
This happened because of my version of Visual Studio 17. When I upgraded to version 15.4.4 the ef models stopped being created. I had to add <RuntimeFrameworkVersion>2.0.3</RuntimeFrameworkVersion>
to my <PropertyGroup></PropertyGroup>
in my .csproj.
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RuntimeFrameworkVersion>2.0.3</RuntimeFrameworkVersion>
</PropertyGroup>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.