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:

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:

The full nuspec file looks like:

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

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!