here is a solution if some one else has the same issue :
This is a Build Deploy Pipeline for .NET 6 Web App to Azure App Service using Azure DevOps Pipeline
trigger:
pool:
vmImage: ubuntu-latest
variables:
buildConfiguration: 'Release'
dotNetFramework: 'net7.0'
dotNetVersion: '7.0.x'
targetRuntime: 'win-x64'
Build the app for .NET 7 framework
steps:
- task: UseDotNet@2
displayName: 'Use .NET 7 framework'
inputs:
version: $(dotNetVersion)
includePreviewVersions: true
- task: DotNetCoreCLI@2
displayName: 'Restore webmvc app'
inputs:
command: 'restore'
projects: '**/WebMvc.csproj'
feedsToUse: 'select'
restoreDirectory: 'dotnet/WebApiSolution/WebMvc'
- task: DotNetCoreCLI@2
displayName: 'Build webmvc app'
inputs:
command: 'build'
projects: '**/WebMvc.csproj'
workingDirectory: 'dotnet/WebApiSolution/WebMvc'Publish it as .NET 7 self-contained application for linux runtime
- task: DotNetCoreCLI@2
displayName: 'Publish webmvc app'
inputs:
command: publish
publishWebProjects: True
arguments: '--configuration $(BuildConfiguration) --framework $(dotNetFramework) --runtime $(targetRuntime) --self-contained --output $(Build.ArtifactStagingDirectory)'
zipAfterPublish: TruePackage the file and uploads them as an artifact of the build
- task: PublishPipelineArtifact@1
displayName: 'Publish Pipeline Artifact'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: 'WebMVC'