docker-compose.dcproj : Unable to retrieve project metadata. Ensure it’s an SDK-style project. If you’re using a custom BaseIntermediateOutputPath

Sometimes you would add docker to an exicting code first project with ef core or even add ef core to an exciting docker enabled project, and start to develop your entities and relationships then at a time you happy with your work, want migrate your entities and update database, but sudenly see an ominous error in your console

dotnet ef migrations add --project XXX init

docker-compose.dcproj.EntityFrameworkCore.targets(4,5): error MSB4006: There is a circular dependency in the target dependency graph involving target "GetEFProjectMetadata". [XXX\docker-compose.dcproj
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.]

Before enabling docker in project that command would defentaly works in solution directory but after adding docker project into ef core project you need to navigate to your directory of your project and then run that ef migrations .

Leave a Comment