At work we use TeamCity from Jetbrains on our build server, the product itself is the best there is out there.
Good products should be talked up more on twitter in my opinion, so that more people learn about what is good out there. If you’re considering software to use for building software then look no further than TeamCity.
We recently created quite a few nuget packages for internal use at work and we have them building as part of our builds on the buildserver using Teamcity. They used to be class libraries used as externals and these were causing us some pain so we decided to make them into Nuget packages and build them as part of our build process.
Our build process at work is pretty neat, I can push a website/windows service to dev, or staging environments with once click and it build the code, runs all the unit tests, check the level of code coverage is above a certain level and then removes the current installation and installs the new version – all in one click (for production we have 3 clicks due to having to log onto production servers and clicking on a batch file to do remove the old code and install the new version)
To set that up took time but worth doing as it means anyone can build and deploy to any environment with 3 clicks or less, thats quite powerful.
Now before going into the issue, let me say that people use TeamCity in different ways, the way people build Nuget packages will also no doubt differ.
As part of the code we were referencing internal and external Nuget packages, the NuSpec files had the following:-
Wasnt till I suddenly realised that this means go get the latest version of the example package from Nuget if one is available, which wasnt really what we wanted in this scenario.
Versioning packages within Nuget is covered here Versioning Nuget packages and was just what I needed.
Once I updated the Nuspec files to have:-[sourcecode language=”csharp”] <dependency id="ExamplePackage" version="[1.3.2]" />
This square brackets around the version number means that instead of going off to Nuget to get the latest version, go off and get this version (if not installed already).
Now when i do a build it wont try and pull down the latest version of Nuget goodies such as AutoMapper and StructureMap.
Feel free to ask any questions or leave a comment on this post.