Kylar182
Kylar182

Reputation: 119

Ignore Project on DevOps Pipeline

I'm having trouble ignoring a specific project in my DevOps Pipeline. I have a WPF project in the same solution as my .Net MAUI project and I have a Pipeline for the WPF Solution that works but the .Net MAUI one fails on Nuget Restore because it's Using MAUI and a macOS-12 Image.

- task: DotNetCoreCLI@2
displayName: 'Nuget Restore'
inputs:
command: 'restore'
projects: '**/*.csproj
          !**/Portal.Desktop.csproj' # This is supposed to ignore the WPF App
feedsToUse: 'config'
nugetConfigPath: 'nuget.config'

I get a pattern matching error though so apparently that's not right

The Error

Nuget Restore

View raw log Starting: Nuget Restore

Task : .NET Core Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command Version : 2.210.0 Author : Microsoft Corporation Help : docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli

##[error]No files matched the search pattern. Finishing: Nuget Restore

Upvotes: 0

Views: 746

Answers (1)

Bowman Zhu
Bowman Zhu

Reputation: 7146

I can reproduce the match error via using the below YAML:

trigger:
- none

pool:
  vmImage: 'windows-latest'

steps:
- task: DotNetCoreCLI@2
  displayName: 'Nuget Restore'
  inputs:
    command: 'restore'
    projects: '
      **/*.csproj
      !**/TestResultsTests.csproj'
    feedsToUse: 'select'
    vstsFeed: '1f64a82f-77ad-4770-a098-772faae01ed1'

enter image description here

The error disappear after change my YAML to this:

trigger:
- none

pool:
  vmImage: 'windows-latest'

steps:
- task: DotNetCoreCLI@2
  displayName: 'Nuget Restore'
  inputs:
    command: 'restore'
    projects: |                      #Here is where I change.
      **/*.csproj
      !**/TestResultsTests.csproj
    feedsToUse: 'select'
    vstsFeed: '1f64a82f-77ad-4770-a098-772faae01ed1'

enter image description here

So the issue should comes from your YAML definition.

This is my repository structure:

enter image description here

Upvotes: 1

Related Questions