I have an azure basic Todo App with db and have command in mu yml file to generate migration bundle and i am publishing my app to azure with db migrations using github sync from visual studio code .
I have azure free subscription plan and when i run below command on azure console it gives me an error stated below -
./migrationsbundle1 --environment Production
or
migrationsbundle1 --environment Production
migrationsbundle folder does exist there. added screenshot
My .yml file code
name: Build and deploy ASP.Net Core app to Azure Web App - todoapp16625
on:
push:
branches:
- starter-no-infra
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
permissions:
contents: read #This is required for actions/checkout
steps:
- uses: actions/checkout@v4
- name: Set up .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 'v8.0'
- name: Build with dotnet
run: dotnet build --configuration Release
- name: dotnet publish
run: dotnet publish -c Release -o "${{env.DOTNET_ROOT}}/myapp"
- name: Install dotnet ef
run: dotnet tool install --global dotnet-ef --version 8.*
- name: Create migrations bundle
run: dotnet ef migrations bundle --runtime linux-x64 -o "${{env.DOTNET_ROOT}}/myapp/migrationsbundle1"
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: .net-app
path: ${{env.DOTNET_ROOT}}/myapp
deploy:
runs-on: windows-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
permissions:
id-token: write #This is required for requesting the JWT
contents: read #This is required for actions/checkout
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: .net-app
- name: Login to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_F19122AA73A748A4955F5317EA8AC5A4 }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_32169E0C8D74405695D3D98075F3C4D3 }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_B80CDBFEC1154EAABEDFB1F1B93F19B0 }}
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: 'todoapp16625'
slot-name: 'Production'
package: .
Posting my comments as answer:
Initially, the command using migrationsbundle
and migrationsbundle1
was not recognized, as the generated file missing .exe
extension.
Upon reviewing the files provided in the screenshot, the output file was being created without specifying the .exe
extension which is mandatory to run the command.
I have tested the same by generating a migrationsbundle.exe
file and it worked.
As you are running the command in Windows Azure App Service, the command should be:
migrationsbundle1 --environment Production