可能存在许多原因,导致此错误出现。 以下示例中,可在构建部分中使用以下步骤来解决此问题。
...
- task: DotNetCoreCLI@2
inputs:
command: 'build'
projects: '**/*.csproj'
arguments: '--configuration $(BuildConfiguration)'
...
# The branch triggers a pipeline run and the pipeline builds dotnet components.
trigger:
branches:
include:
- main
- feature/*
# Set the repository default branch
# and initiate a pipeline run immediately.
resources:
repositories:
- repository: self
ref: main
fetchDepth: 1
jobs:
- job: Build
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UseDotNet@2
inputs:
version: '6.0.x'
- script: dotnet build --configuration $(BuildConfiguration)
此方法的可行性取决于您的特定情况。