5 Comments

  1. hlattanzio

    Thank you for putting this all together.

    I’ve followed your configurations in order to update the build to generate the migrations script. The csproj file contains and I can see that it is restored as part of the Restore step of the build, however, when the command line task runs in order to run the dotnet ef command, I continue to get this error:

    No executable found matching command “dotnet-ef”

    Any suggestions of what else could be missing?

    • hlattanzio

      Ok, I’ve answered my own question, however, it might be worth noting in your article.

      The project I needed to run the migrations in was a sub-directory, so I had to modify the Working Folder in the Advanced section of the Command line step, such that I wasn’t at the root of $(Build.SourcesDirectory).

      Thanks

  2. Joe

    Awesome blog – I have a few questions though.

    If you go with the option of letting the build pipeline run the migration scripts won’t you be faced with a couple of problems?

    1. Will the ‘ef migrations script’ command generate scripts for ALL migrations all of the time or will it just do the latest migration
    2. When you execute the scripts in this fashion, does it invalidate the fact we’ve recorded which scripts have been run previously and therefore you potentially risk executing old migrations?

    • abel

      Hi Joe
      1. The ef migrations script command should only generate you the scripts that you will need to go from one version to another
      2. It will only generate the scripts you need so you won’t be running scripts multiple times

Leave a Reply to abel Cancel reply

Your email address will not be published. Required fields are marked *