Search code examples
azure-devopsnugetazure-artifacts

how do I add a package to a devops artifact? (NonAuthoritativeInformation your package was pushed)


Access to my normal package feed is temporarily failing and I need to organise an alternative.

I have the relevant files locally files

It would be wonderful if I could simply upload them into the feed. But I see no upload option to do this.

When I click Connect to feed I see instructions

nuget.exe push -Source "feedname" -ApiKey az <packagePath>

So I tried at the dos command line but got an error

The specified source 'feedname' is invalid. Provide a valid source.

The feed does actually exist.

[Update]

After following Turbot's advice, and after figuring out my user name was my email, I got a message NonAuthoritiveInvormation "Your package was pushed" but I do not see it yet.

Checking this issue

[Update]

My commands look like this

nuget.exe sources add -Name "MyFeedName" -Source "https://dev.azure.com/MyTeam/MyApp/_packaging?_a=feed&feed=MyFeedName" -username "kirsteng@mydomain.com.au" -password "mypat"


nuget push -Source "MyFeedName"  -ApiKey az C:\Users\kirst\.nuget\packages\mypackage\1.0.173\mypackage.1.0.173.nupkg

I put the commands into a .bat file When I re-run it I also see that

The name specified has already been added to the list of available package sources. 
Provide a unique name.

I guess that makes sense.

I also see

NonAuthoritiveInformation 
https://dev.azure.com/MyTeam/MyApp/_packaging?_a=feed&feed=MyFeedName 
Your Package was pushed

Yet it was not.

I also tried enclosing the package name in double quotes.

I see from typing nuget ? that

 push              Pushes a package to the server and publishes it.
                   NuGet's default configuration is obtained by loading %AppData%\NuGet\NuGet.config, then loading any n
                   uget.config or .nuget\nuget.config starting from root of drive and ending in current directory. 

I wonder if that is relevant somehow.

Nuget.exe is Version: 5.9.1.11

Here are the docs

[Update]

I found that the add command was writing to

C:\Users\kirst\AppData\Roaming\NuGet\Nuget.Config

I edited that to remove the feed and re-ran my bat file. Then I was able to get it to work.

The other thing I had wrong was the url itself. It should have been like

https://pkgs.dev.azure.com/mycompany/myapp/_packaging/myfeedname/nuget/v3/index.json

Solution

  • to be precise in Azure DevOps using Nuget you need to supply userid and PAT to in nuget.config or in command.

    nuget sources add -Name <SourceName> -Source <SourceURL> -username <UserName> -password <Pat>
    nuget push -Source <SourceName> -ApiKey az <PackagePath exp:(.\Get-Hello.1.0.0.nupkg)>