Problem deploying C# Function App to Azure from Azure Devops pipeline

Paul D'hertoghe 20 Reputation points
2025-06-12T08:05:15.7333333+00:00

I have a C# function app solution that I can deploy from Visual Studio to Azure. It works.

When I create an Azure Devops build pipeline and perform a build and deploy to Azure, the function app fails to start. The error I see using application insights|Failures is:

dotnet exited with code 134 (0x86) Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified. 

When I check the zip artifact after the build, the zip contains version 8.0.0.0 of the MicroSoft.Bcl.AsyncInterfaces.assembly.
Maybe not unimportant: the Azure function is hosted on a linux runtime.

What could be wrong?

Azure DevOps
{count} votes

Accepted answer
  1. Harshitha Veeramalla 1,301 Reputation points Microsoft External Staff Moderator
    2025-06-16T09:16:28.01+00:00

    Hi @Paul D'hertoghe,

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this.

    Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.

    Issue :

    Azure Function App fails to start after being deployed from Azure DevOps

    Solution :

    the publish devops task needs self-contained to be set to true. It seems that the default linux environment doesn't have .NET 8 installed?

    • The default Linux environment for Azure Functions currently does not support .NET 8 as a framework-dependent runtime.
    • If you don't set --self-contained true, your app assumes that .NET 8 is already installed on the Azure Function host.
    • The latest working DevOps task you provided creates a self-contained deployment that bundles the .NET runtime and all necessary dependencies, ensuring it runs smoothly in Azure Linux Function environments.

    Please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefited from it.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Paul D'hertoghe 20 Reputation points
    2025-06-12T08:44:02.22+00:00

    I found the solution: the publish devops task needs self-contained to be set to true. It seems that the default linux environment doesn't have .NET 8 installed?

    - task: DotNetCoreCLI@2
    
      displayName: Publish
    
      inputs:
    
        command: 'publish'
    
        publishWebProjects: false
    
        projects: '$(workingDirectory)/**/*.csproj'
    
        arguments: '--configuration Release --output $(System.DefaultWorkingDirectory)/publish_output --no-restore --runtime linux-x64 --self-contained true' 
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.