Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure devops 如何使用Azure DevOps发布?_Azure Devops_Azure Pipelines - Fatal编程技术网

Azure devops 如何使用Azure DevOps发布?

Azure devops 如何使用Azure DevOps发布?,azure-devops,azure-pipelines,Azure Devops,Azure Pipelines,我正在尝试使用Azure DevOps为.NET Core 2.1示例项目(它是开箱即用的默认项目)设置CI/CD管道和发布过程。到目前为止,我没有修改默认代码,也没有在项目中添加/删除任何引用。它正在本地构建和运行,没有任何错误 我已经创建了一个简单的构建管道,其中包含恢复、构建和发布等任务 由于某些原因,发布失败,出现以下错误 ##[section]Starting: Publish ======================================================

我正在尝试使用Azure DevOps为.NET Core 2.1示例项目(它是开箱即用的默认项目)设置CI/CD管道和发布过程。到目前为止,我没有修改默认代码,也没有在项目中添加/删除任何引用。它正在本地构建和运行,没有任何错误

我已经创建了一个简单的构建管道,其中包含恢复、构建和发布等任务

由于某些原因,发布失败,出现以下错误

##[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)'

该错误是因为在
--输出D:\a\1\a\Devops Demo
中没有
,并且该值包含空格,因此只需将文件夹名称固定为
“D:\a\1\a\Devops Demo”


.yaml
中,我可以看到您使用变量
$(build.artifactstagindirectory)
,因此将其更改为
“$(build.artifactstagindirectory)”

可能意味着您的fileglob匹配多个proj文件,使其更严格?在您的
--输出中
在文件夹名称中添加
。谢谢@4c74356b41,请详细说明一下您的建议。@Shaykibaramczyk参数设置为--configuration$(BuildConfiguration)--output$(build.artifactstagingdirectory)。我在哪里添加“”?好的,我刚刚在日志中看到生成到
D:\a\1\a\Devops Demo
的变量,我认为因为
Devops Demo
中有一个空格,它可能会导致问题。在
工作目录
值中,可以将其更改为“DevopsDemo”吗?或者将输出更改为“$(build.artifactstagingdircetory)”?嘿,捕捉得好!