Home: nuget.exe push without specifying source should push to NuGet.org

Created on 8 Apr 2016  路  27Comments  路  Source: NuGet/Home

  • NuGet Version: 3.4.2.828
  • Default NuGet.config in user appdata
  • nuget push NuGetTestPackage.1.0.0.nupkg <api key>

Expected:
NuGet pushes the package to NuGet.org

Actual:
Error message Source parameter was not specified.

ByDesign Docs

Most helpful comment

this is pretty annoying of an issue especially because I can't find any documentation on what the actual url is supposed to be on nuget.org, had to go through GitHub issues to find the url.

All 27 comments

No, that's fine and a by design change

If this is by design then can we get the profile page sample to have the source parameter.

I will update the doc page for our Command-line reference http://docs.nuget.org/Consume/Command-Line-Reference. Is there something else we should be update @BobbyCannon ?

The profile page that gives you example do not tell you that you must now provide the source. I was needing to deploy so I just rolled back to the older exe so my old publish scripts would work. I'll attempt later but the profile example to set key and push need updating.

nuget.exe setApiKey [key] 
nuget.exe push MyPackage.1.0.nupkg

This is the page you are thinking about right?

https://docs.nuget.org/consume/command-line-reference

No, I'm talking about. At the bottom, when it's helping you setup your API key.

https://www.nuget.org/account

However, those docs should probably be updated also.

Ha, I see. Thanks for confirming. I will make this change today or tomorrow and send out a PR.

https://github.com/NuGet/NuGetGallery/pull/3011, will create the one for the command line reference doc soon.

@rrelyea can you do a quick review for the above PR's? I will commit after that

Both are now merged. The Account page change will go live with the next deployment. The docs should be live now

What about symbol packages? How do I specify to where they should be uploaded? Which source should I use?

The same -Source parameter

When you are using the -Source parameter when you push a package and its symbols at the same time, then it gets pushed to http://nuget.smbrc.net. More information is given here https://docs.nuget.org/create/creating-and-publishing-a-symbol-package

@harikmenon: I think the Nuget.exe command line help needs updating to reflect this as well:

NuGet Version: 3.5.0.1938
-Source                  (src)  Specifies the server URL. If not specified, nuget.org is used unless DefaultPushSource config value is set in the NuGet config file.

Issue #669 provides updated documentation which doesn't work. So this is severely broken right now and I can't publish my package.

@ygoe - #669 is probably not the issue you wanted to point to. Can you please point to the problem documentation? And give details of your problem?

I was caught by this very unpleasant decision to make an incompatible change to nuget and require some "Source" parameter to be set. Whatever a "Source" is. I have never done that before and now my push script broke. I found this issue here by the error message I got. It wasn't overly helpful in resolving the error. Then I found the linked change to the NuGet documentation that seems to try to explain to the user how to set that Source parameter. I did exactly that and it fails, too.

This is my situation. I can't use nuget.exe to push my packages anymore. Well done. Where and how would you like me to report that issue so that you're able to help me out?

Can you please give an example of the command line you are trying to do your push?
Which version of NuGet.exe are you using 3.4.4? 3.5.0? other?

I had the same issue with my open source projects. I had to change my PowerShell scripts to just include the source.

& "nuget.exe" push $file.FullName -Source https://www.nuget.org/api/v2/package

I'm on "NuGet Version: 3.5.0.1938".

Here's mine:

& $nugetBin push $packageFile -ApiKey $apiKey -NonInteractive -Source https://www.nuget.org/api/v2/package

NuGet.exe version 3.4.4.1321

Not sure why it changed. Always frustrating when you run the same script you've used for 2 years and it gives a bunch of errors during a release.

@harikmenon Hi - you mentioned above in Jun 2016 that symbol packages are automatically published, ref the docs you linked to.
That doc still does not specify the -Source parameter, which is now mandatory.

Do you know if it is still possible to publish the package and the symbols in one operation or whether we now need two separate pushes with two different -Source params?

Thanks in advance.

NuGet Version: 4.4.1.4656

If you do nuget.exe push the commandline says:

options:

 -Source                  (src)                                  Specifies the server URL. If not specified, nuget.org is used unless DefaultPushSource config value is set in the NuGet config file.

Later on, gives the example:

nuget push foo.nupkg 4003d786-cc37-4004-bfdf-c4f3e8ef9b3a

nuget push foo.nupkg 4003d786-cc37-4004-bfdf-c4f3e8ef9b3a -src http://customsource/

nuget push foo.nupkg

nuget push foo.nupkg.symbols

nuget push foo.nupkg -Timeout 360

Several of those which wouldn't work because there's no "defaulting" of the -src parameter.

Offending code in the repo:
NuGet.Commandline/NuGetCommand.resx:321 at dev branch head at the time of the writing

NuGet.Commandline/NuGetCommand.resx:321 at current dev branch head (this should read right after a fix has been merged to the dev branch)

NuGet.Commandline/NuGetCommand.resx:321 at current release-4.5.0-rtm branch head (this should read right after a fix has been merged to the 4.5.0 release branch, if ever)

EDIT: this used to be the actual behavior in older NuGet versions (at least 3.3.0 really defaulted to NuGet.org if not specified).

This is still broken. The actual help files in the latest Nuget.exe still show this as optional.

this is pretty annoying of an issue especially because I can't find any documentation on what the actual url is supposed to be on nuget.org, had to go through GitHub issues to find the url.

What is THIS?

nuget push SomePkg.nupkg -Source https://api.nuget.org/v3/index.json
Pushing SomePkg.0.1.0.nupkg to 'https://www.nuget.org/api/v2/package'...
PUT https://www.nuget.org/api/v2/package/
Forbidden https://www.nuget.org/api/v2/package/ 1573ms

Why I type v3 but it sends to v2

Was this page helpful?
0 / 5 - 0 ratings