I'm currently working on a YAML pipeline in Azure pipelines and have run into a snag. I already have a work around; however, I was curious if anyone has encountered this and solved for it properly. Here is the issue.
I have a project that contains multiple solutions. Some solutions are utilizing package.config and others are using PackageReference. This wasn't really a big deal until we got to performing a nuget restore on the solutions within the project using the task below.
- task: NuGetToolInstaller@1 displayName: 'Detect\Install NuGet'- task: NuGetCommand@2 displayName: 'Restore NuGet Packages' inputs: restoreSolution: '**\*.sln' feedsToUse: 'config' command: 'restore'
The tasks above successfully detect an existing NuGet installation, if not it install the latest version of NuGet. Then it performs a nuget restore of all packages using PackageReference. This is where the rub comes into play. Any solutions that are utilizing package.config are skipped by this task since it defaults to the PackageReference solutions. To get around this issue we have added an additional NuGet command task that we point to a local nuget.config file within our repository.
Note: The first task utilizes the system default nuget.config file configured on our pipeline agents.
- task: NuGetCommand@2 displayName: 'Restore NuGet Packages for package.config' inputs: restoreSolution: '**\*.sln' feedsToUse: 'config' nugetConfigPath: 'nuget.config'
While this isn't adding a large amount of time to your builds, it still isn't ideal as it would be nice to utilize a single task. Any help would be greatly appreciated.
Thanks,Source Code