azure devops .NET 7 build failed

Gora LEYE 21 Reputation points MVP
2022-11-11T16:19:57.51+00:00

259614-logs.txtHi when trying to build .NET 7 project using azure devops always failed

I have a windows server 2019 in witch the latest version of visualstudio 2022 is installed

the error messages is :
*

[error]Error: There was an error when attempting to execute the process 'C:\agents\vsts-agent-win-x64-2.213.1_work_tool\dotnet\dotnet.exe'. This may indicate the process failed to start. Error: spawn C:\agents\vsts-agent-win-x64-2.213.1_work_tool\dotnet\dotnet.exe ENOENT*

Here is the build pipeline

https://github.com/azurecorner/virtual-network-service-endpoints/blob/main/azure-pipelines.yml

variables:
buildConfiguration: 'Release'

steps:

  • task: UseDotNet@2
    inputs:
    packageType: 'sdk'
    version: '7.0.100'
  • task: DotNetCoreCLI@2
    displayName: Restore
    inputs:
    command: 'restore'
    projects: 'dotnet/WebApiSolution/WebMvc/WebMvc.csproj'
    feedsToUse: 'select'
    restoreDirectory: '$(buildConfiguration)'
  • task: DotNetCoreCLI@2
    displayName: Build
    inputs:
    command: 'build'
    projects: 'dotnet/WebApiSolution/WebMvc/WebMvc.csproj'
    workingDirectory: '$(buildConfiguration)'
  • task: PublishBuildArtifacts@1
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,202 questions
0 comments No comments
{count} votes

Accepted answer
  1. Dave Patrick 426.1K Reputation points MVP
    2022-11-11T18:10:47.137+00:00

    Devops / TFS is not currently supported here on Q&A. The product group for Azure DevOps / TFS actively monitors questions over at
    https://developercommunity.visualstudio.com/report?space=21&entry=problem
    https://developercommunity.visualstudio.com/report?space=22&entry=problem
    https://azure.microsoft.com/en-in/support/devops/

    --please don't forget to upvote and Accept as answer if the reply is helpful--

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Gora LEYE 21 Reputation points MVP
    2022-11-13T14:55:16.59+00:00

    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:

    • main

    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: True

      Package the file and uploads them as an artifact of the build

    • task: PublishPipelineArtifact@1
      displayName: 'Publish Pipeline Artifact'
      inputs:
      targetPath: '$(Build.ArtifactStagingDirectory)'
      artifactName: 'WebMVC'
    0 comments No comments