I am building asp.net core web application using full .NET framework 4.6.1 template like this-
My project.json shows-
"frameworks": {
"net461": { }
},
I wanted to use EF6 (not EF core) , hence install entity framework using NuGet package manager using this command-
Install-Package Entityframework
Project.json added this entry-
"EntityFramework": "6.1.3",
When I am trying to create a DBcontext and model using below Command:
Scaffold-DbContext "Server=XXXXX;Database=XXXXXXX;User Id=XXXXXXX;password=XXXXXXX" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -t TABLENAME
It throws below error:
Scaffold-DbContext: The term 'Scaffold-DbContext' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
As I understand (since I have Powershell v3.0 and .NET core 1.0.1), rest of the EF tools and dependencies are missing in my project.json. So which are tools and dependencies I need to add in my project.json to use EF6 (not EF core)?
Some of the options I can see are like below. But not sure which one is right for EF6
"EntityFramework.MicrosoftSqlServer":
"EntityFramework.SqlServer":
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-rc2-final"
I didn't get what you mean by using core in .net but if you are targeting you project to old .net you need to install compatible version.
For .net 4.8 following package version will work:
Install-Package Microsoft.EntityFrameworkCore.Tools -Version 3.1.25
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.