skip to Main Content

I’m facing an issue when trying to generate Entity Framework Core models from an Azure SQL Database using the dotnet ef dbcontext scaffold command.

Connection String

Server=[server name].database.windows.net;Database=[database name];User ID=;Password="[password]";Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;

Command Used

dotnet ef dbcontext scaffold "Server=[server name].database.windows.net;Database=[database name];User ID=;Password="[password]";Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" Microsoft.EntityFrameworkCore.SqlServer -o . --context-dir .

The words in [blocks] are filled with the correct private info.

Issue

When I run the command above, the console says:

Build started...
Build failed. Use dotnet build to see the errors.

When I run dotnet build, I get no errors, just 24 warnings

What I’ve Tried

Checked for build errors using dotnet build, but there are none.
Adjusted the connection string and folder paths, but the issue persists.
Connected to server using server address, username and password with sql server management studio and with sql server object explorer in Visual Studio

Environment

  • Windows 10
  • Microsoft.EntityFrameworkCore 7.0.13
  • Microsoft.EntityFrameworkCore.Design 7.0.13
  • Microsoft.EntityFrameworkCore.SqlServer 7.0.13
  • Microsoft.EntityFrameworkCore.Tools 7.0.13
  • Dotnet Version 6.0.400-preview.22330.6

2

Answers


  1. Chosen as BEST ANSWER

    I was in the wrong directory, huge difference between "C:UsersNicksourcereposProject Name" and "C:UsersNicksourcereposProject NameProject Name"


  2. Looks like 6.0.400 is an SDK version from August 2022

    I would start by making sure you have the latest runtime and SDK for .NET 6

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search