How to filter .wixproj from nuget restore task in yml file?

73 Views Asked by At

In my yml build file I have a nuget task which restores all nuget packages for my sln, however there is a wix project in that sln which is throwing the following error. “NU1503: skipping restore for project ‘project location’ The project file may be invalid or missing targets required for restore”

The .wixproj does not have any nuget packages so I want to be able to ignore this from the nuget restore command task. How would I do this?

Current nuget restore task looks like this…

-task: NuGetCommand@2
inputs:
restoreSolution: ‘path/*.sln’

Ive tried suppressing the warning in various ways, but hasn’t seemed to work.

1

There are 1 best solutions below

1
Miao Tian-MSFT On BEST ANSWER

You can use the following yaml to only restore project with .csproj.

- task: NuGetCommand@2
  inputs:
    command: 'restore'
    restoreSolution: '**/*.csproj'

You can also refer this similar question Skipping restore for project 'SetupWix.wixproj'. The project file may be invalid or missing targets required for restore (NU1503).