In the last few months, I’ve been using AppVeyor CI on some of my open-source projects (along with Cake for the build scripts). I really like it, but one thing bothered me: I couldn’t find a way to manually publish packages to NuGet.org directly from AppVeyor. I had to download the package locally, then upload it manually from my machine (either with nuget push
on the command line, or via the web form on NuGet.org), which is always error-prone.
The solution turned out to be pretty easy, once I knew where to look. I’ll describe the steps here.
Initial configuration
1. Configure NuGet.org as a deployment environment
Before you can push packages to the NuGet gallery, you need to configure NuGet.org as a deployment environment (you only need to do this once, unless you want to publish under multiple identities).
Once logged in to AppVeyor, go to the Environments page, click New Environment, and select NuGet as the deployment provider:
Choose a name for the environment (e.g. NuGet.org) and enter your API Key (no, it’s not my real key in the screenshot…). You can find your NuGet API key on your account page on NuGet.org when you’re logged in. Just leave the URL empty if you want to deploy to the official NuGet gallery. When you’re done, click Add environment.
2. Configure artifacts in your project
In your project settings, make sure the NuGet packages generated by your build process are configured as artifacts. You just need to add the path to the .nupkg files (the deployment name is optional):
That’s all! You’re now ready to publish.
Publishing packages
Start a new build, and when it’s complete, click on the Deploy button for this build:
Select Nuget.org as the deployment environment:
Click Deploy, and wait for the magic to happen. If everything goes smoothly, you should see something like this:
Congratulations, your package is now on the NuGet gallery. Go there and check!
Hey,
For Open Source project, I prefer using appveyor.yml
https://www.appveyor.com/docs/build-configuration#appveyor-yml
It contains your CI configuration and gives an easy way for another developer to understand how your project is built and tested and he can fork it if needed.
You can even extract it from appveyor settings.
Regards,
Is there a set of different steps to publish netstandard libraries? I just followed these steps – thanks BTW – and all other libraries were published except netstandard ones.
Hi Xavier,
Sorry for the late reply, I’m not always getting notifications for comments…
A netstandard library should be no different (in fact, some of the libraries I publish with this technique target netstandard). Once you have a nupkg, the process is the same.
such a pain in the ass to push nuget with appveyor
never did lost so much time
you’re the oonly one to publish proper screen shot of undocumented GUI
many thanks I was quite struggling !