When trying to scaffold with asp.net core this command
scaffold-dbcontext \"Data Source=(local);Initial Catalog=MyDb;Integrated Security=True;\" M
For me... when copy pasting the command from the microsoft docs, for some reason extra spacing was added around the hyphens.
Removing the hyphens fixed it:
wrong:
Scaffold - DbContext "Server=(localdb)\mssqllocaldb;Database=myDbName;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer - OutputDir Models
good:
Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=myDbName;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
The docs also say if you receive this error, try restarting Visual Studio.
https://docs.microsoft.com/en-us/ef/core/get-started/aspnetcore/existing-db