.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Package Manager Console Host Version 5.8.0.6930
Type 'get-help NuGet' to see all available NuGet commands.
PM> Install-Package Microsoft.EntityFrameworkCore.Tools
Restoring packages for I:\myapp\Store\Store.csproj...
GET https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.tools/index.json
OK https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.tools/index.json 473ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.tools/5.0.1/microsoft.entityframeworkcore.tools.5.0.1.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.tools/5.0.1/microsoft.entityframeworkcore.tools.5.0.1.nupkg 21ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.design/index.json</div> OK https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.design/index.json 136ms
GET https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.design/5.0.1/microsoft.entityframeworkcore.design.5.0.1.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.design/5.0.1/microsoft.entityframeworkcore.design.5.0.1.nupkg 19ms
Installing Microsoft.EntityFrameworkCore.Design 5.0.1.
Installing Microsoft.EntityFrameworkCore.Tools 5.0.1.
Installing NuGet package Microsoft.EntityFrameworkCore.Tools 5.0.1.
Committing restore...
Generating MSBuild file I:\myapp\Store\obj\Store.csproj.nuget.g.props.
Writing assets file to disk. Path: I:\myapp\Store\obj\project.assets.json
Restored I:\myapp\Store\Store.csproj (in 1,45 sec).
Successfully uninstalled 'Microsoft.CSharp 4.5.0' from Store
Successfully installed 'Humanizer.Core 2.8.26' to Store
Successfully installed 'Microsoft.CSharp 4.7.0' to Store
Successfully installed 'Microsoft.EntityFrameworkCore.Design 5.0.1' to Store
Successfully installed 'Microsoft.EntityFrameworkCore.Tools 5.0.1' to Store
Executing script file 'C:\Users\myuser\.nuget\packages\microsoft.entityframeworkcore.tools\5.0.1\tools\init.ps1'
Executing nuget actions took 4,14 sec
Time Elapsed: 00:00:06.2699254
but dotnet ef still produces same errror
I:\myapp>dotnet ef
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* You intended to execute a .NET program, but dotnet-ef does not exist.
* You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
52 Points
574 Posts
Scaffold Postgres 13 database for EF Core
Dec 28, 2020 12:15 AM|kobruleht|LINK
Looking for a method to create EF core entity classes from existing Postgres 13 database in Windows.
Database has 300 tables.
According to
http://www.npgsql.org/efcore/index.html In Visual Studio 2019 command prompt
dotnet ef dbcontext scaffold "Host=my_host;Database=my_db;Username=my_user;Password=my_pw" Npgsql.EntityFrameworkCore.PostgreSQL
Command should do this but it throws error
Could not execute because the specified command or file was not found.
Possible reasons for this include:
I verified that NpgSql.EntityFrameworkCore.PostgreSQL v5.0.1 package is installed from Nuget.
How to create entity classes for EF Core in Postgres ?
Participant
780 Points
264 Posts
Re: Scaffold Postgres 13 database for EF Core
Dec 28, 2020 08:38 AM|Jerry Cai|LINK
Hi,kobruleht
According to this error message, you can try running VS as an admin and adding
in Package Manager Console.
This a tutorial, you can check it:
https://medium.com/@RobertKhou/getting-started-with-entity-framework-core-postgresql-c6fa09681624
Best Regards,
Jerry Cai
Member
52 Points
574 Posts
Re: Scaffold Postgres 13 database for EF Core
Dec 28, 2020 10:08 AM|kobruleht|LINK
Hi!
I installed tools:
but dotnet ef still produces same errror
Participant
780 Points
264 Posts
Re: Scaffold Postgres 13 database for EF Core
Dec 29, 2020 03:29 AM|Jerry Cai|LINK
Hi,konruleht
Try this in cmd:
Best Regards,
Jerry Cai