.Net8 Isolated FunctionApp not showing up in Azure after deployment

FunctionApp works fine when deployed from Visual Studio using the downloaded publish profile from Azure. But when I try to deploy from Gitlab using ci/cd pipeline, the FunctionApp is not displayed in Azure.

I downloaded the app content from Azure portal for both deployments and compared the folders. I could find the exe in the app content that was published from Visual Studio but code deployed by Gitlab pipeline compiled to dll.

For some reason OutputType Exe setting in the project file is being ignored by the Gitlab pipeline.

After migrating FunctionApps to isolated model, I updated the git.yml file to use mcr.microsoft.com/dotnet/sdk:8.0 image and these are the commands to build/publish

  • dotnet build $SLN_PATH -c Release -v d
  • dotnet publish $SLN_PATH -o ./out -c Release

The FunctionApp was working fine with in-process model and sdk:6.0 image for both deployments (from Visual Studio using publish profile & Gitlab pipeline). Not sure if anything chaged in sdk:8.0 image.

How can I make it publish an exe instead of dll?

Visual Studio compiling to exe but gitlab pipeline is producing a dll

gitlab yml file


stages:
  - build
  - deploy

variables:
    GIT_PROJECT_CLONE: 'https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/xyz/functionApp-net8.git --branch main'
    DOTNET_PUBLISH_ARGS: "${DOTNET_BUILD_ARGS} /p:Configuration=Release /p:DeployOnBuild=true /p:PublishProfile=${PROFILE_NAME}"
    BUILD_ARTIFACTS: "./src/**/bin/**"
    NUGET_PACKAGES: "${CI_PROJECT_DIR}/.nugetcache"
    DOTNET_BUILD_ARGS: "-c Release -v d"
    AZURE_CLIENT_ID: "xyz"
    AZURE_RESOURCE_TYPE: "azure_functions"
    AZURE_CLI_PARAMS: "--verbose"

build:
    image: mcr.microsoft.com/dotnet/sdk:8.0
    stage: build
    script:
      - 'apt-get update && apt-get install -y zip'
      - |
        if [ -z "${GIT_PROJECT_CLONE}" ] ; then
          echo "[INFO] GIT_PROJECT_CLONE not set, skip clone"
        else  
          echo "[INFO] GIT_PROJECT_CLONE is set , do clone ${GIT_PROJECT_CLONE}"
          cd ..
          git clone $GIT_PROJECT_CLONE
          ls -lart
          cd $CI_PROJECT_DIR
        fi
      - |
        if [ -z "${SLN_PATH}" ] ; then
          echo "[INFO] SLN_PATH not set, searching for .sln"
          SLN_PATH=`find . -type f -regex ".*.sln"`
        fi
        echo "[INFO] SLN_PATH set to ${SLN_PATH}."
        dotnet build $SLN_PATH $DOTNET_BUILD_ARGS
        echo "[INFO] DOTNET_PUBLISH_ARGS set to ${DOTNET_PUBLISH_ARGS}."
        echo "[INFO] actual dotnet publish ${SLN_PATH} ${DOTNET_PUBLISH_ARGS}"
        dotnet publish $SLN_PATH -o ./out -c Release
        ls -lart
        cd $OUT_FOLDER
        ls -lart
        zip -r ../out.zip *
        cd ..
        ls -lart
        cd $CI_PROJECT_DIR
    artifacts:
      paths:
        - $OUT_FOLDER
        - $OUT_FOLDER.zip
      expire_in: 1 week
    cache:
      key: "$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG"
      paths:
        - .nugetcache
    rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
      when: never
    - if: $CI_COMMIT_TAG != null
      when: never
    - when: on_success

.deploy:
  stage: deploy
  id_tokens:
    CI_JOB_JWT:
      aud: "vault"
  secrets:
    AZURE_PASSWORD:
      vault: AZURE_PASSWORD@xyz
  variables:
    AZURE_RESOURCE_GROUP: "xyz"
    AZURE_SUBSCRIPTION: "xyz"
    AZURE_TENANTID: "xyz"
    AZURE_USERNAME: "xyz"
    AZURE_APP_NAME: "$AZURE_APP_NAME"
  extends: .azure_deploy
  environment: 
    name: test/azure/${AZURE_RESOURCE_GROUP}/functionapp/${AZURE_APP_NAME}
    url: https://${AZURE_APP_NAME}.scm.azurewebsites.net
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
      when: never
    - if: $CI_COMMIT_TAG != null
      when: never
    - when: on_success

2

Below given .yml file worked for me.

zip the content of publish folder

stages:
  - Build
  - Deploy

variables:
    function_name: "csharpfunc6sep"
    Client_id: "xxxxxxxxxxxxxx"
    Client_secret: "xxxxxxxxxxxxxxxx"
    tenant_id: "xxxxxxxxxxxxxx"

Build:
    stage: Build
    image: mcr.microsoft.com/dotnet/sdk:8.0
    script: 
        - apt-get update && apt-get install -y zip
        - dotnet publish --configuration Release --output ./output
        - cd output
        - zip -r ../output.zip ./*

    artifacts:
        paths:
          - ./output.zip
        expire_in: 1 day
Deploy:
    stage: Deploy
    script:
        - curl -sL https://aka.ms/InstallAzureCLIDeb | bash
        - az login --service-principal -u $Client_id -p $Client_secret --tenant $tenant_id
        - az functionapp deployment source config-zip --resource-group Vivek-RG --name $function_name --src ./output.zip


    dependencies:
      - Build
    rules:
      - when: on_success

NOTE :- Node images with core-tools tag can also be used in Deploy stage like mcr.microsoft.com/azure-functions/node:4-node20-core-tools for running az and func command as Azure CLI and Azure Function core tools are inbuilt in these images.

Currently func command support only net6.0 for dotnet-isolated during deployment using func.

OUTPUT:

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật