azure-devops - ##[错误]未找到与指定模式匹配的项目文件

标签 azure-devops azure-pipelines

我在构建管道方面遇到问题。

Pipeline

Get Sources

代理池托管在 VS2017

YAML 是

pool:
  vmImage: 'VS2017-Win2016'

variables:
  buildConfiguration: 'Debug'

steps:
- task: DotNetCoreInstaller@0
  displayName: 'Use .NET Core sdk 2.1.5'
  inputs:
    version: 2.1.403


- task: DotNetCoreCLI@2
  displayName: Restore
  inputs:
    command: restore

    projects: '**/Api*.csproj'


#Your build pipeline references an undefined variable named ‘Parameters.projects’. 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
- task: DotNetCoreCLI@2
  displayName: Build
  inputs:
    projects: '$(Parameters.projects)'

    arguments: '--configuration $(BuildConfiguration)'


#Your build pipeline references an undefined variable named ‘Parameters.projects’. 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

- task: DotNetCoreCLI@2
  displayName: Publish
  inputs:
    command: publish

    publishWebProjects: false

    projects: '$(Parameters.projects)'

    arguments: '--configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory)'

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact'
  inputs:
    PathtoPublish: '$(build.artifactstagingdirectory)'

运行时,构建任务有如下日志
2018-10-29T18:28:43.7087338Z ##[section]Starting: Build
2018-10-29T18:28:43.7093502Z ==============================================================================
2018-10-29T18:28:43.7093580Z Task         : .NET Core
2018-10-29T18:28:43.7093785Z 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.
2018-10-29T18:28:43.7093818Z Version      : 2.141.0
2018-10-29T18:28:43.7093864Z Author       : Microsoft Corporation
2018-10-29T18:28:43.7093895Z Help         : [More Information](https://go.microsoft.com/fwlink/?linkid=832194)
2018-10-29T18:28:43.7093925Z ==============================================================================
2018-10-29T18:28:44.4833128Z [command]C:\Windows\system32\chcp.com 65001
2018-10-29T18:28:44.4926077Z Active code page: 65001
2018-10-29T18:28:45.1965225Z ##[error]Project file(s) matching the specified pattern were not found.
2018-10-29T18:28:45.2037015Z ##[section]Finishing: Build

我注意到日志指的是 2.141.0,因为我正在恢复最新的 SDK 2.1.403 为什么会这样?难道是托管的 VS2017 代理不支持最新版本的 .netcore?

[更新]

我为 Parameters.projects 添加了一个变量
parameters projects

但是构建任务仍然有错误。
2018-10-29T21:07:38.6774331Z ##[section]Starting: Build
2018-10-29T21:07:38.6781540Z ==============================================================================
2018-10-29T21:07:38.6781632Z Task         : .NET Core
2018-10-29T21:07:38.6781676Z 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.
2018-10-29T21:07:38.6781762Z Version      : 2.141.0
2018-10-29T21:07:38.6781807Z Author       : Microsoft Corporation
2018-10-29T21:07:38.6781853Z Help         : [More Information](https://go.microsoft.com/fwlink/?linkid=832194)
2018-10-29T21:07:38.6781915Z ==============================================================================
2018-10-29T21:07:39.5030735Z [command]C:\Windows\system32\chcp.com 65001
2018-10-29T21:07:39.5157531Z Active code page: 65001
2018-10-29T21:07:39.5840366Z ##[error]Project file(s) matching the specified pattern were not found.
2018-10-29T21:07:39.5916864Z ##[section]Finishing: Build

最佳答案

发布以防万一这对将来的任何人有帮助

我有我的 vmImage设为 ubuntu使用以下设置:

projects: '**\*.csproj'

反斜杠正在扔东西,我不得不切换到以下内容:
projects: '**/*.csproj'

我从假设 Windows 的指南中复制。足够微妙,我花了一段时间才注意到😅

关于azure-devops - ##[错误]未找到与指定模式匹配的项目文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53052083/

相关文章:

azure - 如何在Azure管道中为特定分支启用批处理

azure-devops - Azure 管道 yaml 权限被拒绝

.net - 如何使用托管代理在 VSTS 中构建针对 .NET 3.5 的 .csproj?

azure - 在Azure发布管道中是否可以一次手动触发多个发布管道?

tfs - VSTS 释放多行变量

asp.net-mvc - 使用 YAML 的 Azure DevOps Pipeline 用于解决许多项目

powershell - 如何使用 REST API 销毁 TFVC 中的分支?

Azure 二头肌循环存储帐户

Azure DevOps 预部署条件排除主分支以外的分支

azure - 无法创建 Azure DevOps 服务连接 : fields in the service connection are not expected: releaseUrl