Search code examples
nugetazure-pipelineswixnuget-package-restore

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


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.


Solution

  • 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).