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?
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>
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'