scaffold-dbcontext basepath exception on EntityFrameworkCore

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

Question

I kept getting the following exception when I scaffold the entity framework core. I googled and tried multiple suggestions to no avail. Any help is appreciated.

I am using Visual Studio Community 2017. I have installed the Microsoft.EntityFrameworkCore.SqlServer,
Microsoft.EntityFrameworkCore.SqlServer.Design and
Microsoft.EntityFrameworkCore.Tools packages via NuGet

This is the exception:

Exception calling "AddFromFile" with "1" argument(s):
"'basePath' cannot be an empty string ("") or start with the null character.
Parameter name: basePath"

These are the commands I have tried:

Scaffold-DbContext -Connection "Server=1234;UserId=2345;password=3456;Database=4567;" -Provider Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -Force

Scaffold-DbContext "Data Source=1234;Initial Catalog=4567;User ID=2345;Password=3456" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -force -v

Scaffold-DbContext -Connection "Data Source=1234;UserId=2345;password=3456;Database=4567;" -Provider Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -Force
1
2
3/22/2017 8:41:45 PM

Popular Answer

I got this error when trying to Scaffold a database with the -OutputDir value set to a directory that didn't exist. I was hoping it would create the directory but it doesn't. Just make sure your output directory exists and you shouldn't see this error.

0
4/10/2017 2:30:36 PM


Related Questions





Related

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