Kirsten
Kirsten

Reputation: 18076

##[error]Project file(s) matching the specified pattern were not found

I am having problems with a build pipeline.

Pipeline

Get Sources

The agent pools is hosted VS2017

The YAML is

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

When it runs, the build task has the following log

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

I note that the log refers to 2.141.0 where as I am restoring the latest SDK 2.1.403 Why would that be? Could it be that the hosted VS2017 agent does not support the latest version of .netcore?

[Update]

I added a variable for Parameters.projects parameters projects

However the build task has an error still.

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

Upvotes: 9

Views: 40599

Answers (3)

krishna kurtakoti
krishna kurtakoti

Reputation: 128

I am trying to build and publish a multiproject solution in dotnet core. The solution structure is:

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

Now, I just want to build the sampleTest.API dotnet core project. I just need to define in the build task, the path to the project as shown below.

The yaml file for build task for the pipeline in Azure Deveops is shown below:

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

If we need to build based on searching for all the 'cs.proj' files - we do

projects: '**/*.csproj'

Sample build task using the classic Editor in Azure Devops is shown below:

enter image description here

enter image description here

Upvotes: 0

Jack Casey
Jack Casey

Reputation: 1836

Posting just in case this helps anyone in the future

I had my vmImage set as ubuntu with the following set:

projects: '**\*.csproj'

The backslash was throwing things off, I had to switch to the following:

projects: '**/*.csproj'

I copied from a guide that was assuming Windows. Subtle enough, it took me a while to notice 😅

Upvotes: 14

Shayki Abramczyk
Shayki Abramczyk

Reputation: 41545

You need to define in the build task which .csproj files you want to build.

In your case, the definition is in a variable $(Parameters.projects).

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

    arguments: '--configuration $(BuildConfiguration)'

You can replace this variable in your .csproj (e.g. **/*.csproj for all .csproj files in all subfolders):

- task: DotNetCoreCLI@2
  displayName: Build
  inputs:
    projects: '**/*.csproj'

    arguments: '--configuration $(BuildConfiguration)'

Or go to the variables tab and add the Parameters.projects variable:

enter image description here

Upvotes: 7

Related Questions