3.3 Beta - Having trouble uploading .zip files to the Octo NuGet feed with powershell

So I’m working on re jigging my CD pipeline to deploy our ASP.NET 5 (Core) app with the new .zip package functionality in 3.3beta001

I took this powershell command from the Library/Packages page… I couldn’t get it to work.

$wc = new-object System.Net.WebClient
$wc.UploadFile(“http://xxx.xxx.xxx.xxx/nuget/packages/raw?apiKey=API-XXXXXXXXXXXXXXXXXX”, “MyApp.1.0.0.zip”)

I could only get the following error:

Exception calling “UploadFile” with “2” argument(s): "An exception occurred during a WebClient request."
At line: 1 char:1
$wc.UploadFile("http://xxx.xxx.xxx.xxx/nuget/packages/raw?apiKey=API-XXXXXXXXXXXXX
Category Info : Not Specified: (:slight_smile: [], Method Invocation Exception
FullyQualifiedErrorId : Web Exception

Am I doing it wrong? Is there a specific Powershell version I should be using or something? help!

Hal

Hi Hal,

Thanks for getting in touch! And thanks for trying out the beta.
The command on the library page is wrong, and we have just fixed it but haven’t released a new beta yet. Please see the doco here: http://docs.octopus.com/display/OD/Deploying+ASP.NET+Core+Web+Applications

The difference is nuget/packages when it should be api/packages
Could you make that change and let me know if it helps?

Thanks again!
Vanessa

Hi Vanessa,

Yeah, I figured that out when looking at the API docs on GitHub but changing it to …/api/… just made it return a 400 Bad Request instead :confused:

Thanks for the link to the confluence page that looks like it’ll be really helpful.

Any other suggestions? we are currently running our teamcity and octopus on the same box so is there a stop gap that avoids the api call for now maybe? ie copy file here ??

Surely I’m just doing the API call wrong though… :frowning:

Thanks for taking the time,

Hal

Hi Hal,

Sounds like it’s working actually, a 400 error is when the package exists. If you delete the package from the library then try again it should work!
I’ll find out if we have an overwrite option for that specific upload method.

Vanessa

Hi Hal,

I have been informed you should be able to add ‘&replace=true’ to the end of the url if you want to overwrite the package with the same version.

Please let me know if it doesn’t work.
Vanessa

Oh yes… yes it does… Win!!! Thank you very much for your prompt assistance. We like you Octo-Folk :smiley:

ps cheers for the replace tip too :wink: