EF Migrations с Azure конвейерными задачами - PullRequest
1 голос
/ 16 января 2020

Мне кажется, что запускать миграцию с конвейером сборки yaml с задачами нелегко, потому что при попытке создать задачу, которая запускает dotnet ef миграции, появляется следующая ошибка.

==============================================================================
Task         : PowerShell
Description  : Run a PowerShell script on Linux, macOS, or Windows
Version      : 2.151.1
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
==============================================================================
Generating script.
========================== Starting Command Output ===========================
##[command]"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'C:\agent\_work\_temp\a2cda363-57d3-416e-80ae-fb82a650ff74.ps1'"
Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a .NET Core program, but dotnet-ef does not exist.
  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
##[error]PowerShell exited with code '1'.
##[section]Finishing: Roll back migrations

На сервере сборки у меня установлен глобальный tnet -ef. Так что я не уверен на данный момент, почему это дает мне эту ошибку. Ниже приведен скрипт yml.

- task: PowerShell@2
  displayName: "Apply migrations"
  inputs:
    targetType: 'inline'
    script: |
      dotnet ef database update --project $(Build.SourcesDirectory)\DataLayer\DataLayer

1 Ответ

0 голосов
/ 17 января 2020

Оказывается, это windows проблема пользователя. do tnet core 3 больше не имеет встроенного в do tnet do tnet -ef, и я знал об этом и установил do tnet -ef как глобальный, но, очевидно, он выполняет пользовательские настройки c на машине. Разработчику, который создал конвейер сборки, нужно было добавить do tnet -ef глобально со своим пользователем на той же машине, чтобы это работало. Надеюсь, что это помогает кому-то еще в совместной среде.

...