Я пытаюсь настроить конвейер CI / CD и опубликовать процесс для примера проекта .NET Core 2.1 (это проект по умолчанию, который поставляется из коробки) с помощью Azure DevOps. Пока что я не изменил код по умолчанию и не добавил / не удалил никаких ссылок в проекте. Он собирается и работает без ошибок локально.
Я создал простой конвейер сборки с такими задачами, как Restore, Build и Publish.
По какой-то причине публикация завершается неудачно со следующей ошибкой.
##[section]Starting: Publish
==============================================================================
Task : .NET Core
Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command. For package commands, supports NuGet.org and authenticated feeds like Package Management and MyGet.
Version : 2.149.0
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?linkid=832194)
==============================================================================
[command]C:\windows\system32\chcp.com 65001
Active code page: 65001
[command]"C:\Program Files\dotnet\dotnet.exe" publish "D:\a\1\s\Devops Demo\Devops Demo.csproj" --configuration release --output D:\a\1\a\Devops Demo
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1008: Only one project can be specified.
Switch: Demo
For switch syntax, type "MSBuild /help"
##[error]Error: C:\Program Files\dotnet\dotnet.exe failed with return code: 1
##[error]Dotnet command failed with non-zero exit code on the following projects : D:\a\1\s\Devops Demo\Devops Demo.csproj
##[section]Finishing: Publish
Я гуглил и основал несколько человек, жалующихся на эту ошибку, но ни у кого не было определенного решения для нее.
До сих пор я не пробовал ничего необычного в своем проекте и конфигурации CI / CD. Выше ошибка является блокирующим для меня, так как я не могу продолжить свою простую установку devops.
Пожалуйста, дайте мне знать, если у вас есть какие-либо предложения для меня, чтобы исправить эту ошибку.
Мой YAML, как показано ниже,
pool:
name: Hosted VS2017
#Your build pipeline references an undefined variable named ‘Parameters.RestoreBuildProjects’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references an undefined variable named ‘Parameters.RestoreBuildProjects’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references the ‘BuildConfiguration’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971
#Your build pipeline references the ‘BuildConfiguration’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971
steps:
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: restore
projects: '$(Parameters.RestoreBuildProjects)'
- task: DotNetCoreCLI@2
displayName: Build
inputs:
projects: '$(Parameters.RestoreBuildProjects)'
arguments: '--configuration $(BuildConfiguration)'
- task: DotNetCoreCLI@2
displayName: Publish
inputs:
command: publish
publishWebProjects: True
arguments: '--configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory)'
workingDirectory: 'Devops Demo'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'