Over the past month I have volunteered to help out in the creation of some nuget packages. The packages I said I’d help with are NUnit and Simple.Data. I volunteered as I have a dedi box and wanted to try and script it from my TeamCity installation.
In order to get the projects working I have created a custom MSBuild script that does things in the following order:
- Nuget Creation
This was all thanks to help from Jeremy Skinner. Jeremy has managed to do all the steps above as part of his build but chooses to run the push to nuget.org from a powershell script. manually so he can make sure it never happens unexpectedly. I am very much a fan of automation. Therefore I wanted to find a way to automate this push to nuget as part of a specific build configuration. Out of the box, TeamCity has no powershell build runner. In order to try to execute the powershell script, I was wrapping the call in a .cmd file. But this was not working fantastically and was hanging and throwing errors for me.
I managed to find a Powershell TeamCity plugin (login as a guest to see it). This allowed a build step to be added to TeamCity config that execute Powershell scripts directly and therefore helps to automate the process.
When this script is installed I see the following in my TeamCity build runner menu
A simple call to the correct .ps1 file means the publish to nuget! Hope this helps