代码之家  ›  专栏  ›  技术社区  ›  Kirsten

##[错误]找不到与指定模式匹配的项目文件

  •  0
  • Kirsten  · 技术社区  · 6 年前

    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,在这里我正在恢复最新的sdk2.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
    
    1 回复  |  直到 6 年前
        1
  •  5
  •   Shayki Abramczyk Cece Dong - MSFT    6 年前

    您需要在构建任务中定义 .csproj 要生成的文件。

    在您的例子中,定义是在一个变量中 $(Parameters.projects)

    - task: DotNetCoreCLI@2
      displayName: Build
      inputs:
        projects: '$(Parameters.projects)'
    
        arguments: '--configuration $(BuildConfiguration)'
    

    csproj先生 (例如,对于所有子文件夹中的所有.csproj文件,.*/*.csproj):

    - task: DotNetCoreCLI@2
      displayName: Build
      inputs:
        projects: '**/*.csproj'
    
        arguments: '--configuration $(BuildConfiguration)'
    

    Parameters.projects 变量:

    enter image description here

        2
  •  8
  •   Jack Casey    5 年前

    张贴只是为了以防万一这有助于任何人在未来

    vmImage 设为 ubuntu

    projects: '**\*.csproj'
    

    反斜杠把东西扔掉了,我不得不换成以下内容:

    projects: '**/*.csproj'
    

    我从一本装着窗户的指南上抄下来的。很微妙,我花了一段时间才注意到

        3
  •  0
  •   krishna kurtakoti    4 年前

    我正在尝试在dotnetcore中构建和发布一个多项目解决方案。 解决方案结构是:

    sampleTest.API
          sampleTest.API.csproj
    sampleTest.Data
          sampleTest.Data.csproj
    sampleTest.Identity
          sampleTest.Identity.csproj
    sampleTest.Web
          sampleTest.Web.csproj
    sampleTest.sln
    

    steps:
    - task: DotNetCoreCLI@2
      displayName: Build
      inputs:
        projects: 'sampleTest.API/*.csproj'
        arguments: '--configuration $(BuildConfiguration)'
    

    如果我们需要在搜索所有“cs.proj”文件的基础上进行构建-我们需要

    projects: '**/*.csproj'
    

    在Azure Devops中使用classic编辑器的构建任务示例如下所示:

    enter image description here

    enter image description here