Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify which project file to use when inside project directory

Trying to use "dotnet ef" command in Package Manager Console. the PMC is cd to the .csproj directory, and still getting:

dotnet : Specify which project file to use because this 'C:\Users\PC-NAME\Source\Repos\TestProject\Test" contains more than one project file.
At line:1 char:1

dotnet ef migrations add TestMigration
  + CategoryInfo          : NotSpecified: (Specify which p...e project file.:String) [], RemoteException
  + FullyQualifiedErrorId : NativeCommandError

Tried use -p / --p and point to the .csproj file / directory - still same error.

Using .NET CORE, MVC project, Latest EF Core 2.0.2 version.

There's no so much valuable data on the internet about that problem, just a wild guess that dotnet ef command is looking for .exe file to run on.

Hoping for help.

like image 336
user3181843 Avatar asked Jan 29 '26 19:01

user3181843


1 Answers

If your project contains more than one .csproj file you should move them to another directory other than the project folder and run again your command line.

In my case I have two .csproj in the project folder: CoreWebApplication.csproj and CoreWebApplication-backup.csproj, so I moved the CoreWebApplication-backup.csproj and I kept the CoreWebApplication.csproj

dotnet ef ... -p CoreWebApplication.csproj -s CoreWebApplication.csproj
like image 89
Nader Chebbi Avatar answered Feb 01 '26 16:02

Nader Chebbi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!