Since “NuGet Authenticate” is a recommended approach now instead of “NuGet” task, how do you publish pipeline metadata when pushing the packages (the functionality that is provided using publishPackageMetadata argument)?
Asked
Active
Viewed 508 times
1
-
Nuget auth is mainly used to authenticate some three-party feeds and non-organziation feeds. Nuget tasks can be used to restore, pack, publish. It and nuget auth task are not mutually replaceable, they are complementary. To publish package metadata, you need to use nuget task and specify the `publishPackageMetadata` argument – Hugh Lin May 20 '21 at 10:03
-
Documentation for "NuGet" task says: "The NuGet Authenticate task is the new recommended way to authenticate with Azure Artifacts and other NuGet repositories. This task no longer takes new features and only critical bugs are addressed". Also, the samples for "NuGet authenticate" task use script task to execute nuget command line for restore/push, etc. – Alex I May 20 '21 at 14:13
-
Seems the same question was asked in VS Developer Community. https://developercommunity.visualstudio.com/t/publish-pipeline-metadata-using-with-nuget-authent/1425969 – Palec Sep 15 '21 at 15:56
-
The NuGet task does two major things: it authenticates against the feeds and runs a nuget.exe command. The NuGet Authenticate task extracts the first responsibility in a way that may be used even by nuget.exe, dotnet.exe and MSBuild.exe run e.g. in a script. The tasks like NuGet or .NET Core CLI are responsible for other things too, though, which includes the publishPackageMetadata functionality. If you want to achieve the same using nuget.exe from a command line, you need to implement it somehow. – Palec Sep 15 '21 at 16:15
-
I do not know how to achieve the publishPackageMetadata functionality using nuget.exe in a script, at the moment. A good starting point might be the implementation of the functionality in the current NuGet task: https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/Common/packaging-common/provenance.ts It might not be possible to achieve that in a script, though. Even if it is possible, it might require a call to an API of DevOps outside the nuget.exe call... – Palec Sep 15 '21 at 16:18