EFCore 1.1 Scaffold-DbContext provider error

asp.net-core entity-framework entity-framework-core


I can't get Scaffold-DbContext to work on a EFCore 1.1 application.

PM> Scaffold-DbContext -Connection "'Server=.;Database=testsite;User Id=sa;Password=Password1234;'" -Provider Microsoft.EntityFrameworkCore.SqlServer -OutputDir EFContext -Context ApplicationDbContext

This is the error that it's giving:

Scaffold-DbContext : Cannot bind argument to parameter 'Path' because it is an empty string. At line:1 char:1 + Scaffold-DbContext + ~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Scaffold-DbContext], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Scaffold-DbContext

Not exactly a forthcoming error message so I ran just Scaffold-DbContext and it gives me this error after prompting for the Provider. The provider I'm trying to use is Microsoft.EntityFrameworkCore.SqlServer.

2/24/2017 5:01:48 PM

Accepted Answer

In my case I fixed it installing Microsoft.EntityFrameworkCore.Tools. Make sure to close and reopen VisualStudio. (Do not forget to add the -force flag to the end in order to reapply the changes from scratch) Example:

Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -force

So, my dependencies looks like:


After that it worked as expected.

10/7/2018 7:40:00 PM

Popular Answer

If you have multiple project in your solution you can try to add the option -StartupProject "nameofyourprojectstartup" with the project name that have to run this command.

I had the same error when trying to run "add-migration" with multiple project (Docker support) in my solution.

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow