You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure Pipeline中DotNetCoreCLI任务变量识别异常:Clean任务正常但Restore任务报项目文件未找到

Fix for Azure Pipeline Restore Task Project Not Found Error

The issue here is the single quotes wrapping each project pattern in your multi-line projects input for the Restore task. When using YAML's multi-line pipe (|) syntax, each line is treated as a literal string. So instead of looking for **/Company.Web.csproj, Azure Pipelines is searching for '**/Company.Web.csproj' (including the single quotes), which doesn't exist in your repo.

Your Clean task works because it uses a single line—Azure Pipelines correctly parses the quoted string as a single pattern. But for multi-line entries, the quotes become part of the search pattern, leading to the "Project file(s) matching the specified pattern were not found" error.

Corrected Restore Task YAML

- task: DotNetCoreCLI@2
  displayName: Restore
  inputs:
    command: custom
    custom: restore
    projects: |
      **/$(webProject).csproj
      **/$(dbProject).csproj

Why This Works

When you remove the single quotes from each line in the multi-line projects list:

  1. Each line is treated as an independent glob pattern.
  2. Azure Pipelines correctly substitutes the variables ($(webProject) and $(dbProject)) into valid paths.
  3. The glob patterns **/Company.Web.csproj and **/Company.Database.csproj are properly recognized and matched against your project files.

You confirmed variables render correctly and replacing variables with literal text works—this fix aligns with that behavior by removing the unnecessary quotes that were breaking the pattern matching.

内容的提问来源于stack exchange,提问作者zep426

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.29 01:12:51