Pushing Package to Private NuGet Server with API Key

Jan 15, 2012 at 2:18 AM

I'm trying to configure Nugetter to push my NuGet package to a private NuGet Server which requires an API Key.

At first, I specified my API Key in the "Api Key or File Path" field and the push failed because it could not find a file with the name of my Api Key:

Could not find file 'C:\Builds\1\{my solution}\{my build definition}\Sources\{my api key}'.

So I created a folder and file in my solution:  Nugetter\apikey.txt.  The contents of this text file are only my API Key (I could not find an example in the documentation).  Now, Nugetter tells me that it cannot find an API key in the file:

GetApiKey
Did not find an API key in the file: Nugetter\apikey.txt - was looking in this path: C:\Builds\1\{my solution}\{my build definition}\Sources\Nugetter\apikey.txt

I think that I have the rest of the fields configured properly:

Create Only - Do Not Publish: False

Invoke Push Switch: True

Source (Push Destination): http://{private nuget server}:{port}/

Any help will be greatly appreciated!

Jan 27, 2012 at 6:27 AM

Doesn't work for me too.

What i tried so far:

  • Set an ApiKey at my private NuGet server and provided it in my build defintion at "Api Key or File Path" --> Doesn't work because NuGetter tries to find a filed named like my ApiKey
  • Put a NuGetApi.key file containing only the api key to my source code  --> Doesn't work "Did not find an API key in the file..."
  • Changed NuGetApi.key content to <ApiKey>myApiKey</ApiKey> --> Doesn't work "Doesn't work "Did not find an API key in the file..."
  • Changed NuGetApi.key content to <key>myApiKey</key> --> Doesn't work "Did not find an API key in the file..."
  • No ApiKey in build definition and no api key set at my private NuGet server --> Doesn't work "Error reported in the NuGet Process: No API Key was provided and no API Key could be found for..." That's surprising because there is no api key needed at all

So pushing to a NuGet server doesn't seem to work at all.

NuGet server version: 1.6.0.0

NuGetter version: 1.2.11252.2

BuildTemplate: NuGetterVersioningBuildTemplate.xaml

Any help will be greatly appreciated!

Coordinator
Jan 28, 2012 at 6:19 PM
buckindb, rirob,
 
I have rerun all of my tests and the push is working as expected. 
 
Question to buckindb:  after the build (and error message) was there a file at 'C:\Builds\1\{my solution}\{my build definition}\Sources\{my api key}'?
 
To Both:
It looks like you are both working with private NuGet galleries.  The API key pattern for NuGet is a GUID 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee' and that's what NuGetter is looking for via a RegEx expression.  Are your private keys using the same pattern?
Regards,
  MarkNic
 
Mar 7, 2012 at 11:28 AM

i am getting the following error

 

PushWithNuGet

Push Arguments: push "\\jadoo-3439\TFSBuilds\ReturnUser\ReturnUser_20120307.32\NuGetPackage\user.1.0.9.31.nupkg" af41b8b0-4aaa-4cc6-9728-479de73d8f60 -s "http://localhost:64644/nuget"

Error reported in the NuGet Process: Failed to process request. 'Method Not Allowed'. The remote server returned an error: (405) Method Not Allowed

 

 

Where as i can publish it from command prompt without any issues.

when i do the following from command prompt

nuget push user.1.0.9.31.nupkg -s http://localhost:64644/ af41b8b0-4aaa-4cc6-9728-479de7

Can you throw some light, it would be lot help to me.

 

Regards,

Abhijit

 

Apr 30, 2012 at 12:37 AM

Something that's missing from the docs is to ensure that the IIS worker process has write permissions to the Packages sub-folder (or wherever the packages are going to end up). In the Security dialog for the Packages folder, ticking the Modify checkbox for the IIS_IUSRS group usually does it.