Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to NuGet.org in PublishUrl #1241

Closed
kentcb opened this issue May 14, 2016 · 7 comments
Closed

Default to NuGet.org in PublishUrl #1241

kentcb opened this issue May 14, 2016 · 7 comments

Comments

@kentcb
Copy link
Contributor

kentcb commented May 14, 2016

Description

New versions of NuGet require source be specified, but FAKE's NuGetHelper does not provide a means of doing so.

Repro steps

Using the latest NuGet client, attempt to publish a package.

Expected behavior

The package is published.

Actual behavior

NuGet spits out this error:

Source parameter was not specified.

Known workarounds

NuGet 3.4.4 apparently fixes another regression so that the config could be overridden. Without that, I don't know of any workarounds.

Related information

  • Windows 10
  • .NET 4.6
@vasily-kirichenko
Copy link
Contributor

I conform the bug:

Creating .nuspec file at D:\github\FSharp.Configuration\NuGet\FSharp.Configuration.0.6.0.nuspec
Created nuspec file D:\github\FSharp.Configuration\NuGet\FSharp.Configuration.0.6.0.nuspec
D:\github\FSharp.Configuration\packages\NuGet.Commandline\tools\nuget.exe pack -Version 0.6.0 -OutputDirectory "D:\github\FSharp.Configuration\nuget" "D:\github\FSharp.Configuration\NuGet\FSharp.Configuration.0.6.0.nuspec"
Deleting D:\github\FSharp.Configuration\NuGet\FSharp.Configuration.0.6.0.nuspec
D:\github\FSharp.Configuration\packages\NuGet.Commandline\tools\nuget.exe push "D:\github\FSharp.Configuration\nuget\FSharp.Configuration.0.6.0.nupkg" PRIVATEKEY  in WorkingDir: D:\github\FSharp.Configuration\NuGet Trials left: 5
Source parameter was not specified.
D:\github\FSharp.Configuration\packages\NuGet.Commandline\tools\nuget.exe push "D:\github\FSharp.Configuration\nuget\FSharp.Configuration.0.6.0.nupkg" PRIVATEKEY  in WorkingDir: D:\github\FSharp.Configuration\NuGet Trials left: 4
Source parameter was not specified.
D:\github\FSharp.Configuration\packages\NuGet.Commandline\tools\nuget.exe push "D:\github\FSharp.Configuration\nuget\FSharp.Configuration.0.6.0.nupkg" PRIVATEKEY  in WorkingDir: D:\github\FSharp.Configuration\NuGet Trials left: 3
Source parameter was not specified.
D:\github\FSharp.Configuration\packages\NuGet.Commandline\tools\nuget.exe push "D:\github\FSharp.Configuration\nuget\FSharp.Configuration.0.6.0.nupkg" PRIVATEKEY  in WorkingDir: D:\github\FSharp.Configuration\NuGet Trials left: 2
Source parameter was not specified.
D:\github\FSharp.Configuration\packages\NuGet.Commandline\tools\nuget.exe push "D:\github\FSharp.Configuration\nuget\FSharp.Configuration.0.6.0.nupkg" PRIVATEKEY  in WorkingDir: D:\github\FSharp.Configuration\NuGet Trials left: 1
Source parameter was not specified.
D:\github\FSharp.Configuration\packages\NuGet.Commandline\tools\nuget.exe push "D:\github\FSharp.Configuration\nuget\FSharp.Configuration.0.6.0.nupkg" PRIVATEKEY  in WorkingDir: D:\github\FSharp.Configuration\NuGet Trials left: 0
Source parameter was not specified.
Running build failed.
Error:
System.Exception: Error during NuGet push. D:\github\FSharp.Configuration\packages\NuGet.Commandline\tools\nuget.exe push "D:\github\FSharp.Configuration\nuget\FSharp.Configuration.0.6.0.nupkg" PRIVATEKEY
   at Fake.NuGetHelper.NuGet(FSharpFunc`2 setParams, String nuspecOrProjectFile) in C:\code\fake\src\app\FakeLib\NuGet\NugetHelper.fs:line 400
   at [email protected](Unit _arg7)
   at Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target) in C:\code\fake\src\app\FakeLib\TargetHelper.fs:line 492

@forki
Copy link
Member

forki commented May 16, 2016

That's an issue in nuget, right? But can you send a pr that helps us?
On May 16, 2016 12:30, "Vasily Kirichenko" [email protected] wrote:

I conform the bug:

Creating .nuspec file at D:\github\FSharp.Configuration\NuGet\FSharp.Configuration.0.6.0.nuspec
Created nuspec file D:\github\FSharp.Configuration\NuGet\FSharp.Configuration.0.6.0.nuspec
D:\github\FSharp.Configuration\packages\NuGet.Commandline\tools\nuget.exe pack -Version 0.6.0 -OutputDirectory "D:\github\FSharp.Configuration\nuget" "D:\github\FSharp.Configuration\NuGet\FSharp.Configuration.0.6.0.nuspec"
Deleting D:\github\FSharp.Configuration\NuGet\FSharp.Configuration.0.6.0.nuspec
D:\github\FSharp.Configuration\packages\NuGet.Commandline\tools\nuget.exe push "D:\github\FSharp.Configuration\nuget\FSharp.Configuration.0.6.0.nupkg" PRIVATEKEY in WorkingDir: D:\github\FSharp.Configuration\NuGet Trials left: 5
Source parameter was not specified.
D:\github\FSharp.Configuration\packages\NuGet.Commandline\tools\nuget.exe push "D:\github\FSharp.Configuration\nuget\FSharp.Configuration.0.6.0.nupkg" PRIVATEKEY in WorkingDir: D:\github\FSharp.Configuration\NuGet Trials left: 4
Source parameter was not specified.
D:\github\FSharp.Configuration\packages\NuGet.Commandline\tools\nuget.exe push "D:\github\FSharp.Configuration\nuget\FSharp.Configuration.0.6.0.nupkg" PRIVATEKEY in WorkingDir: D:\github\FSharp.Configuration\NuGet Trials left: 3
Source parameter was not specified.
D:\github\FSharp.Configuration\packages\NuGet.Commandline\tools\nuget.exe push "D:\github\FSharp.Configuration\nuget\FSharp.Configuration.0.6.0.nupkg" PRIVATEKEY in WorkingDir: D:\github\FSharp.Configuration\NuGet Trials left: 2
Source parameter was not specified.
D:\github\FSharp.Configuration\packages\NuGet.Commandline\tools\nuget.exe push "D:\github\FSharp.Configuration\nuget\FSharp.Configuration.0.6.0.nupkg" PRIVATEKEY in WorkingDir: D:\github\FSharp.Configuration\NuGet Trials left: 1
Source parameter was not specified.
D:\github\FSharp.Configuration\packages\NuGet.Commandline\tools\nuget.exe push "D:\github\FSharp.Configuration\nuget\FSharp.Configuration.0.6.0.nupkg" PRIVATEKEY in WorkingDir: D:\github\FSharp.Configuration\NuGet Trials left: 0
Source parameter was not specified.
Running build failed.
Error:
System.Exception: Error during NuGet push. D:\github\FSharp.Configuration\packages\NuGet.Commandline\tools\nuget.exe push "D:\github\FSharp.Configuration\nuget\FSharp.Configuration.0.6.0.nupkg" PRIVATEKEY
at Fake.NuGetHelper.NuGet(FSharpFunc2 setParams, String nuspecOrProjectFile) in C:\code\fake\src\app\FakeLib\NuGet\NugetHelper.fs:line 400 at [email protected](Unit _arg7) at Fake.TargetHelper.runSingleTarget(TargetTemplate1 target) in C:\code\fake\src\app\FakeLib\TargetHelper.fs:line 492


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#1241 (comment)

@jochenwezel
Copy link

jochenwezel commented Aug 3, 2016

seems to be as being a blocking issue for next upcoming milestone release 3.5

I also just execute without -source parameter

&"D:\GitHub-OpenSource\xyz\_CreateNewNuGetPackage\DoNotModify\NuGet.exe" push "D:\GitHub-OpenSource\xyz\New-NuGetPackages\xyz-beta.nupkg"

and the error shows up:

Source parameter was not specified.

with -source parameter

&"D:\GitHub-OpenSource\xyz\_CreateNewNuGetPackage\DoNotModify\NuGet.exe" push "D:\GitHub-OpenSource\xyz\New-NuGetPackages\xyz-beta.nupkg" -source nuget.org

and the error shows up:

WARNUNG: No API Key was provided and no API Key could be found for 'https://www.nuget.org/api/v2/package'. To save an API Key for a source use the 'setApiKey' command.
Pushing xyz-beta.nupkg to 'https://www.nuget.org/api/v2/package'...
  PUT https://www.nuget.org/api/v2/package/
  Unauthorized https://www.nuget.org/api/v2/package/ 1201ms
Bitte stellen Sie Anmeldeinformationen zur Verfügung für: https://api.nuget.org/v3/index.json
UserName: 

The NuGetConfig at %AppData%\NuGet\NuGet.config is as follows:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <disabledPackageSources>
    <add key="Microsoft and .NET" value="true" />
  </disabledPackageSources>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
NuGetPackages" />
  </packageSources>
  <apikeys>
    <add key="https://www.nuget.org" value="xxxxxxxxxxxxxxxxxxxxxx" />
    <add key="http://nuget.gw.symbolsource.org/Public/NuGet" value="yyyyyyyyyyyyyyyyyyyyyyyyyyyyy" />
  </apikeys>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  <bindingRedirects>
    <add key="skip" value="False" />
  </bindingRedirects>
  <activePackageSource>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
  </activePackageSource>
</configuration>

Tested with NuGet Version: 3.5.0.1520

@kentcb
Copy link
Contributor Author

kentcb commented Mar 18, 2017

Nearly a year later and ran into this again. Had to roll back my NuGet client to 3.3.0.212 (a version I just happened to have lying around for another project).

kentcb added a commit to kentcb/PCLMock that referenced this issue Mar 18, 2017
@kentcb
Copy link
Contributor Author

kentcb commented Mar 18, 2017

Well, I just started on a PR for this and found, to my surprise, that FAKE does support this. However, the parameter name is PublishUrl (not Source) and it defaults to null.

Perhaps it should default to https://www.nuget.org/api/v2/package?

@matthid
Copy link
Member

matthid commented May 6, 2017

Yes the default should be changed. A PR would be welcome.

@matthid matthid changed the title Cannot specify NuGet source Default to NuGet.org in PublishUrl May 6, 2017
@matthid
Copy link
Member

matthid commented May 13, 2017

We got this now in https://www.nuget.org/packages/FAKE/4.61.2 thanks to @zvirja

@matthid matthid closed this as completed May 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants