How to solve issues with deploying EF Core Migrations in an Azure YAML Pipeline task?

88 Views Asked by At

from Visual Studio Code i have create an Web-App from the template react/.net Core and extended this to an WEB-APIenter image description here

That results in a Server-project and a Client project in the solution.

I have integrated the solution as part of my deployment pipeline and the application builds and works, and migrations works from the CLI both to localDB and to DevelopmentDB.

I'm trying to use this https://blogit.create.pt/vini/2022/11/07/entity-framework-update-database-using-azure-pipelines/

as a guide for configuring the pipeline.

Step 1: I already have the pipeline

Step 2: Installing the dotnet-ef-tool - this works

Step 3: Generate SQL scripts does not work

When deploying i initially get the following error:

error MSB4057: The target "GetEFProjectMetadata" does not exist in the project.

I then add the following "msbuildprojectextensionspath" following this post: NET 5 error when adding migration on Entity Framework Core:

But that leads to this error:

System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.ParseOption(Boolean isLongOption, CommandLineApplication command, String[] args, Int32& index, CommandOption& option)
at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args
Index was outside the bounds of the array.

I interpret this as something is missing and i add the following: --msbuildprojectextensionspath obj\local (according to this post and others:

EF migrations not working in Github action, same command works locally)

When doing that i get the following error: error MSB4057:

The target "GetEFProjectMetadata" does not exist in the project.

It seems the issue is with paths/references to the project, could this be because its created from a template that has both a clientAPp and server?

How do i solve the issue "GetEFProjectMetadata" does not exist"?

  • Apparantly it cant find some MetaData?

I read so many posts/forumpost but i dont understand this. Its weird that the template does not work "out-of-the-box" ?

0

There are 0 best solutions below