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:

1

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:

XHTML

1

2

3

<files>

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

</files>

The full nuspec file looks like:

XHTML

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

<?xml version="1.0"?>

<package >

<metadata>

<id>Package</id>

<version>1.0.0</version>

<authors>Folkert</authors>

<owners>Folkert</owners>

<licenseUrl>http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE</licenseUrl>

<projectUrl>http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE</projectUrl>

<iconUrl>http://ICON_URL_HERE_OR_DELETE_THIS_LINE</iconUrl>

<requireLicenseAcceptance>false</requireLicenseAcceptance>

<description>Package description</description>

<releaseNotes>Summary of changes made in this release of the package.</releaseNotes>

<copyright>Copyright 2015</copyright>

<tags>Tag1 Tag2</tags>

<dependencies>

<dependency id="SampleDependency"version="1.0" />

</dependencies>

</metadata>

<files>

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

</files>

</package>

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

1

nuget pack Package.nuspec

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

About The Author

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.