Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to create migrations. Error MSB1009: Project file does not exist

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?

like image 287
Yoro Avatar asked Nov 23 '25 20:11

Yoro


1 Answers

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

like image 57
Yoro Avatar answered Nov 26 '25 16:11

Yoro



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!