Teamcity and Octopus – part 3

We now have a nice clean Release build of our project using a custom MsBuild target. Using this target is important because Teamcity is responsible for the job not just me working on my laptop! Keep that in mind, Teamcity is in charge!

Next step is creating a NuGet package from our build. Again, Teamcity must be able to perform this task.

To create a Nuget package from a directory, we need to create a .nuspec file first.
Creating a nuspec file is easy, navigate to the build directory and open the command from there (shift + right click > open command window here). Now type in:

nuget spec

This command wil create a nuspec file in our build directory. This is just a base file and we need to add some additional information to this file. For example, the content of the package, which is actually the current directory 😉
To add this to the file add the following lines to the file:

      <file src="**\*.*" target="website" />

The full nuspec file looks like:

<?xml version="1.0"?>
<package >
    <description>Package description</description>
    <releaseNotes>Summary of changes made in this release of the package.</releaseNotes>
    <copyright>Copyright 2015</copyright>
    <tags>Tag1 Tag2</tags>
      <dependency id="SampleDependency" version="1.0" />
      <file src="**\*.*" target="website" />

We can now test the package. Open the command prompt again and type:

nuget pack Package.nuspec

If all goes well, a nice and clean package is created using the nuspec file

2015-03-28 15_56_14-TeamCityOctopusYou can open this package using the Nuget Package explorer.

2015-03-28 15_58_07-NuGet Package Explorer - Package.1.0.0Using just MsBuild and NuGet, we have created a clean publish of our website and packaged it into a nuget package. Now that’s a nice start!


I'm a webdeveloper, looking for the best experience, working between development and design. Just a creative programmer. When I'm getting tired of programming C#, i'd love to create 3D images in 3D Studio Max, play the guitar, create an app for Android or crush some plastics on a climbing wall or try to stay alive when i´m descending some nice white powdered snowy mountains on my snowboard.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.