efcore icon indicating copy to clipboard operation
efcore copied to clipboard

Create a migration failed with PowerShell command in PMC

Open MM-RYO opened this issue 4 years ago • 2 comments

Hi,

When I try to create a migration in Visual Studio PMC with the command 'Add-Migration'. It seems the ef-core tool tries to start our app and waits until the web host return timeout. We just upgraded the framework to .net6 and vs2022 to v17.1.0. Before the upgrade, both commands are working fine.

Add-Migration Test1 -Project DAL\EF\Migrations -Context TestContext

Logs: image

But it works if using the ef-core CLI command. it didn't start our app.

dotnet ef migrations add Test1 --project DAL\EF\Migrations --context TestContext

image

Include provider and version information

EF Core version: efcore 6.0.1 Database provider: Npgsql.EntityFrameworkCore.PostgreSQL Target framework: .NET6 Operating system: Windows 10 IDE: VS2022 17.1.0

MM-RYO avatar Feb 16 '22 14:02 MM-RYO

I just tested following steps. it seems working fine but there is a warning message.

  1. In VS2022 and to set other project which there is no entry point method as a startup project
  2. run 'Add-migration' command

An operation was scaffolded that may result in the loss of data. Please review the migration for accuracy.

It is obvious that there are some changes in 'Add-Migration'

MM-RYO avatar Feb 17 '22 04:02 MM-RYO

Duplicate of #27306. Workaround in this comment: https://github.com/dotnet/efcore/issues/27306#issuecomment-1025326642

ajcvickers avatar Feb 18 '22 12:02 ajcvickers