I have a GitHub repository for my Asp Net Core project with EF Core 3.0. I added the following workflow to run each time on updating the develop
branch
name: Develop Build
on:
push:
branches:
- develop
pull_request:
branches:
- develop
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.0.102-servicing-014397
- name: Build with dotnet
run: dotnet build --configuration Release
- name: Test with dotnet
run: dotnet test --configuration Release
- name: Update database
run: dotnet ef database update --c DataContext --p MyProj --s MyProjFactory
The last line returns with an error:
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]Process completed with exit code 1.
How can I apply the latest migrations to the target database using this workflow?
I also had to add commands to install EF tool and to restore all tools to make my workflow work correctly:
- name: Update database run: | dotnet tool install --global dotnet-ef dotnet tool restore dotnet ef database update -c DataContext -p MyProj -s MyProjFactory env: ASPNETCORE_ENVIRONMENT: Development
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With