ojorma
ojorma

Reputation: 385

Add-Migration : Exception calling "AddFromFile" with "1" argument(s): "'basePath' cannot be an empty string ("")

I get an error when I to run add-migration with entitcore on any dotnetcore based project but the equivalent command works when targeting the full dotnetframework

Add-Migration : Exception calling "AddFromFile" with "1" argument(s): "'basePath' cannot be an empty string ("")

see a snapshot of my code. It's a dotnetcore console app. Thesame will work if created the project based on dotnetframewok 4.6.1 enter image description here

Upvotes: 8

Views: 5448

Answers (4)

Dmitri
Dmitri

Reputation: 776

Restart Visual Studio, adding -Name might help in certain cases. Restart seems to be better.

Upvotes: 0

AuthorProxy
AuthorProxy

Reputation: 8047

Add-Migration -Name "TestMigration" -Project BTrips.Domain

Just specify -Name param

Upvotes: 4

Cherry Blossom Girl
Cherry Blossom Girl

Reputation: 553

For me I had an error when I created the class, I wrote the ForeignKey attribute, but it was not necessary, after I removed that attribute it worked correctly enter image description here

Upvotes: 0

rmejias
rmejias

Reputation: 21

I ran into the same issue. I copied the project to another path (C:\Projects) and when I tried to add the migration I got this weird error:

The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Cannot find path '\HOME\Admin\Documents\Visual Studio 2017\Projects\WebApiEFCore\WebApiEFCore\obj\project.assets.json' because it does not exist.

Then I closed the solution, I opened again and I was able to add the migration.

I recreated the error creating another project in the same path I was using at the beginning, so it must be something related with the path.

Hope this could help.

Upvotes: 2

Related Questions