Publish NuGet packages
Buddy turns deployments into a breeze, allowing you to automatically build and push packages to the NuGet Gallery:
Pipeline example
NuGet Configuration
To configure NuGet you first need an account on nuget.org. To push packages to the gallery, you need an API key that can be found on your NuGet account page in the API Keys section (if you don't have any API key you can generate one there).
With the NuGet account and the API key created, you can now proceed to your project. First, add the NugetDemo.nuspec
file to your project directory:
Filesystem window
In this file, you have to specify the following:
<id>
– unique id of the package. It will also server as the package name displayed in the Package Manager Console and will be used in theInstall-Package
command<version>
– package version in a1.2.3
format<authors>
– list of authors separated with commas<description>
– package description that will be displayed in 'Add Package Dialog' in the Package Manager console and after using theGit-Package
command
NuGet configuration
Pipeline configuration
With everything set up, you can now add a new pipeline:
Adding a new pipeline
Once you have set up your new pipeline, it's time to add the action. Select the Custom Build action:
Custom Build action
Switch to the Environment tab and select the library/mono
Docker image in the latest version:
Pull latest version od the docker image
The Docker image is set up, so you can now enter the build commands. Go back to the Run tab and enter the following commands in the SH console:
xbuild /p:Configuration=Release /p:TargetFrameworkVersion="v4.5" NugetDemo/NugetDemo.csproj
nuget setApiKey 777777777-6666665-5555555-4444444-33333333333333
nuget push BuddyNugetDemo.$BUDDY_EXECUTION_COMMENT.nupkg
$$$
$BUDDY_EXECUTION_COMMENT
– this means that every time you execute a pipeline you will be able to enter a comment. This also means that you will have to make sure that whenever you execute it, the package version is correct or it will fail to push the package to the NutGallery.
Last modified on April 26, 2022