Trying to create a build configuration in Azure DevOps, using the new YAML build feature, however I can't seem to get NuGet restore to work when referring to a NuGet.config file (places in the root of my projectfolder)
In my YAML build file I have:
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '$(Parameters.solution)'
feedsToUse: config
nugetConfigPath: 'NuGet.config'
In my log I get the following:
2018-09-25T17:25:07.4624712Z ##[section]Starting: NuGet restore
2018-09-25T17:25:07.4631787Z ==============================================================================
2018-09-25T17:25:07.4631904Z Task : NuGet
2018-09-25T17:25:07.4632707Z Description : Restore, pack, or push NuGet packages, or run a NuGet command. Supports NuGet.org and authenticated feeds like Package Management and MyGet. Uses NuGet.exe and works with .NET Framework apps. For .NET Core and .NET Standard apps, use the .NET Core task.
2018-09-25T17:25:07.4632875Z Version : 2.0.41
2018-09-25T17:25:07.4632964Z Author : Microsoft Corporation
2018-09-25T17:25:07.4633086Z Help : [More Information] (https://go.microsoft.com/fwlink/?LinkID=613747)
2018-09-25T17:25:07.4633196Z ==============================================================================
2018-09-25T17:25:08.2066658Z SYSTEMVSSCONNECTION exists true
2018-09-25T17:25:08.2581545Z SYSTEMVSSCONNECTION exists true
2018-09-25T17:25:08.3645811Z [command]C:\Windows\system32\chcp.com 65001
2018-09-25T17:25:08.3743733Z Active code page: 65001
2018-09-25T17:25:08.4044581Z Detected NuGet version 4.7.0.5148 / 4.7.0+9245481f357ae542f92e6bc5e504fc898cfe5fc0
2018-09-25T17:25:08.4061452Z SYSTEMVSSCONNECTION exists true
2018-09-25T17:25:08.4082708Z Saving NuGet.config to a temporary config file.
2018-09-25T17:25:08.4321725Z ##[section]Finishing: NuGet restore
I've tried using
nugetConfigPath: '$(Build.SourcesDirectory)\\NuGet.config'
instead, with the same result
Any ideas on how to get NuGet restore to work with a NuGet.config file?
Enable package restore by choosing Tools > Options > NuGet Package Manager. Under Package Restore options, select Allow NuGet to download missing packages. In Solution Explorer, right click the solution and select Restore NuGet Packages.
With NuGet Package Restore you can install all your project's dependency without having to store them in source control. This allows for a cleaner development environment and a smaller repository size. You can restore your NuGet packages using the NuGet restore task, the NuGet CLI, or the . NET Core CLI.
nuget restore will ensure all of your NuGet dependencies are downloaded and available to your project. Whereas dotnet restore is a complete restoration of all NuGet dependencies as well as references and project specific tools. Meaning that if you run nuget restore , you are only restoring NuGet packages.
The dotnet restore command uses NuGet to restore dependencies as well as project-specific tools that are specified in the project file. In most cases, you don't need to explicitly use the dotnet restore command, since a NuGet restore is run implicitly if necessary when you run the following commands: dotnet new.
I've figured it out, the NuGet task needs to be changed to:
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '**\*.sln'
feedsToUse: config
nugetConfigPath: 'NuGet.config'
(The only thing which needed changing is restoreSolution
.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With