1

I started to develop Asp.net Core web API with the VS code. But when I try to create ef migrations I get this error:

PS D:\PROJECTS\GrandExchange> dotnet ef --startup-project /API.csproj migrations add IdentityAdded --context Persistence --output-dir Migrations --project /Persistence/Persistence.csproj
MSBUILD : error MSB1009: Project file does not exist.
Switch: D:\Persistence\Persistence.csproj
Unable to retrieve project metadata. Ensure it's an SDK-style project. If you're using a custom BaseIntermediateOutputPath or MSBuildProjectExtensionsPath values, Use the --msbuildprojectextensionspath option.
PS D:\PROJECTS\GrandExchange> 

My folder structure looks like this: Folder structure

So where is the problem?

Yoro
  • 805
  • 8
  • 17

1 Answers1

2

Oh, found a solution elsewhere. I just needed insert the migrations assembly complete path in the --project argument, like this:

PS D:\PROJECTS\GrandExchange\api> dotnet ef migrations add IdentityAdded --context DataContext --output-dir Migrations --project "D:\PROJECTS\GrandExchange\Persistence\Persistence.csproj"

and executed this command from my main startup project (like D:\PROJECTS\GrandExchange\API)

This solution I found there: https://stackoverflow.com/a/63508741/12959213

Yoro
  • 805
  • 8
  • 17