Can't create migrations
JohnyBro opened this issue · comments
Describe the bug
When I try to create a new migration I have the following error.
...\src\Infrastructure\Infrastructure.csproj : error MSB4057: The target "GetEFProjectMetadata" does not exist in the project.
Unable to retrieve project metadata. Ensure it's an MSBuild-based .NET Core project. If you're using custom BaseIntermediateOutputPath or MSBuildProjectExtensionsPath values, Use the --msbuildprojectextensionspath option.
To Reproduce
Steps to reproduce the behavior:
- Install the template
- Create a new project with only api
- Add a property to the
TodoItem
class - Run
dotnet ef migrations add "SampleMigration" --project src\Infrastructure --startup-project src\Web --output-dir Data\Migrations
Expected behavior
Add a migration to the Data/Migrations folder
This is caused by a bug in simplified output paths;
Work around this issue by updating Directory.Build.props and disabling simplified output paths:
<!-- See https://aka.ms/dotnet/msbuild/customize for more details on customizing your build -->
<Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<!-- <ArtifactsPath>$(MSBuildThisFileDirectory)artifacts</ArtifactsPath> -->
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
Thank you for your answer, all good now.