Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1

Viewed 120

I am getting the following error while building my pipeline i have attached my YAML file as well if you can help me with

For switch syntax, type "MSBuild -help"
##[error]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1
##[warning].NET 5 has some compatibility issues with older Nuget versions(<=5.7), so if you are using an older Nuget version(and not dotnet cli) to restore, then the dotnet cli commands (e.g. dotnet build) which rely on such restored packages might fail. To mitigate such error, you can either: (1) - Use dotnet cli to restore, (2) - Use Nuget version 5.8 to restore, (3) - Use global.json using an older sdk version(<=3) to build
Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions
##[error]Dotnet command failed with non-zero exit code on the following projects : D:\a\1\s\src\test.WebApi\test.WebApi.csproj
Finishing: Publish WebApi
# ASP.NET
# Build and test ASP.NET projects.
# Add steps that publish symbols, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  WebProject: 'test.WebApi'
  WebUIProject: 'test.Web'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'
  runtime: 'win-x64'

steps:
- task: DotNetCoreCLI@2
  displayName: RestoreWebApiProject
  inputs:
    command: restore
    projects: '**/$(WebProject).csproj'

- task: DotNetCoreCLI@2
  displayName: RestoreWebUIProject
  inputs:
    command: restore
    projects: '**/$(WebUIProject).csproj'


- task: DotNetCoreCLI@2
  displayName: BuildWebAPIProject
  inputs:
    projects: '**/$(WebProject).csproj'
    arguments: '--no-restore'

- task: DotNetCoreCLI@2
  displayName: BuildWebUIProject
  inputs:
    projects: '**/$(WebUIProject).csproj'
    arguments: '--no-restore'
- task: DotNetCoreCLI@2
  displayName: Test
  inputs:
    command: test
    projects: '**/*[Tt]ests/*.csproj'
    arguments: '--no-restore --no-build'

- task: DotNetCoreCLI@2
  displayName: 'Publish WebApi'
  inputs:
    command: publish
    publishWebProjects: false
    projects: '**/$(WebProject).csproj'
    arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory) --runtime -r $(runtime)'

- task: DotNetCoreCLI@2
  displayName: 'Publish Web'
  inputs:
    command: publish
    publishWebProjects: false
    projects: '**/$(WebUIProject).csproj'
    arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory) --runtime -r $(runtime)'
- task: CopyFiles@2
  inputs:
    Contents: '**'
    TargetFolder: '$(Build.ArtifactStagingDirectory)'

- task: UseDotNet@2
  inputs:
    packageType: 'sdk'
    version: '5.x'

- task: DotNetCoreCLI@2
  displayName: Install dotnet-ef
  inputs:
    command: 'custom'
    custom: 'tool'
    arguments: 'install --global dotnet-ef --version 5.0.10 --ignore-failed-sources'

- task: CmdLine@2
  inputs:
    script: dotnet ef migrations script -o $(Build.ArtifactStagingDirectory)\migrations\script.sql --idempotent --project $(Build.SourcesDirectory)\src\test.WebApi\test.WebApi.csproj

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact: drop'
0 Answers
Related