Create a migration failed with PowerShell command in PMC
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:

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

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
I just tested following steps. it seems working fine but there is a warning message.
- In VS2022 and to set other project which there is no entry point method as a startup project
- 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'
Duplicate of #27306. Workaround in this comment: https://github.com/dotnet/efcore/issues/27306#issuecomment-1025326642