.net core - Azure Function Runtime Version Error: Mismatch or Unsupported Runtime Detected - Stack Overflow

admin2025-04-25  3

I have migrated the Azure function from .Net 6.0 to .Net 8.0 (dotnet-isolated) and runtime version ~4. It is working as expected in local. If I deploy the azure function using Visual studio to the Azure portal, it is working as expected and all the configurations looks good. FUNCTIONS_EXTENSION_VERSION = "~4" FUNCTIONS_WORKER_RUNTIME = "dotnet-isolated" .Net Version is ".Net 8 Isolated" and Stack is ".Net"

Also, runtime version is "4.1036.2.2" in Overview section in the function app. I can confirm that all the values in .csproject file and local settings file has correct values.

But, same azure function When I have deployed using Azure devops CD pipeline, Runtime Version has "error" instead of "4.1036.2.2" in overview section and azure function is not working es expected. Of-course all other settings are popup up correct values except Runtime version.

Please help me what has gone wrong? Please help.

here is my project file:

net8.0 v4 Exe enable enable

what went wrong, what could be the solution for above problem?

I have migrated the Azure function from .Net 6.0 to .Net 8.0 (dotnet-isolated) and runtime version ~4. It is working as expected in local. If I deploy the azure function using Visual studio to the Azure portal, it is working as expected and all the configurations looks good. FUNCTIONS_EXTENSION_VERSION = "~4" FUNCTIONS_WORKER_RUNTIME = "dotnet-isolated" .Net Version is ".Net 8 Isolated" and Stack is ".Net"

Also, runtime version is "4.1036.2.2" in Overview section in the function app. I can confirm that all the values in .csproject file and local settings file has correct values.

But, same azure function When I have deployed using Azure devops CD pipeline, Runtime Version has "error" instead of "4.1036.2.2" in overview section and azure function is not working es expected. Of-course all other settings are popup up correct values except Runtime version.

Please help me what has gone wrong? Please help.

here is my project file:

net8.0 v4 Exe enable enable

what went wrong, what could be the solution for above problem?

Share Improve this question asked Jan 16 at 13:53 Suresh jonnaSuresh jonna 12 bronze badges 1
  • Error says that there is some error in code or while deploying it and that is not related to run time version – RithwikBojja Commented Jan 24 at 4:50
Add a comment  | 

1 Answer 1

Reset to default 0

Configure the Runtime version and .NET framework version under FunctionApp's configuration as shown below:

Modify .csproj as below:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <AzureFunctionsVersion>v4</AzureFunctionsVersion>
    <OutputType>Exe</OutputType>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>
  <ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker" Version="2.0.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="2.0.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.0" />
  </ItemGroup>
  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
  <ItemGroup>
    <Using Include="System.Threading.ExecutionContext" Alias="ExecutionContext" />
  </ItemGroup>
</Project>
  • Validate if the configuration in the pipeline matches those of local environment and Visual Studio deployment. It could be due to minor differences in configuration files or environment variables can cause issues.
  • Check the logs in the Azure DevOps pipeline and the Kudu console for the detailed insights about the runtime error.
  • Restart the function App and reconfigure the deployment by following the steps provided in SO answer by @SiddheshDesai.

Sample Pipeline:

trigger:
- master

variables:
  
  azureSubscription: 'Subscription_ID'
  functionAppName: 'function_app_name' 
  vmImageName: 'windows-latest'  
  workingDirectory: '$(System.DefaultWorkingDirectory)/HTTPdotnetazfunc'

stages:
- stage: Build
  displayName: Build stage

  jobs:
  - job: Build
    displayName: Build
    pool:
      vmImage: $(vmImageName)

    steps:
    - task: UseDotNet@2
      displayName: 'Install .NET Core SDK'
      inputs:
        packageType: 'sdk'
        version: '8.x'  
        installationPath: $(Agent.ToolsDirectory)/dotnet  

    - task: DotNetCoreCLI@2
      displayName: Build
      inputs:
        command: 'build'
        projects: |
          $(workingDirectory)/*.csproj
        arguments: --output $(System.DefaultWorkingDirectory)/publish_output --configuration Release
        

    - task: ArchiveFiles@2
      displayName: 'Archive files'
      inputs:
        rootFolderOrFile: '$(System.DefaultWorkingDirectory)/publish_output'
        includeRootFolder: false
        archiveType: zip
        archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
        replaceExistingArchive: true

    - publish: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
      artifact: drop

- stage: Deploy
  displayName: Deploy stage
  dependsOn: Build
  condition: succeeded()

  jobs:
  - deployment: Deploy
    displayName: Deploy
    environment: 'development'
    pool:
      vmImage: $(vmImageName)

    strategy:
      runOnce:
        deploy:

          steps:
          - task: AzureFunctionApp@1
            displayName: 'Azure functions app deploy'
            inputs:
              azureSubscription: '$(azureSubscription)'
              appType: functionApp
              appName: $(functionAppName)
              package: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'
转载请注明原文地址:http://anycun.com/QandA/1745528292a90796.html