TeamCity Dependencies

Whilst setting up a couple of Build Configurations in Teamcity recently I seemed to struggle with dependencies so I thought I best get this down.

Scenario

Two Build Projects – Build A =Class Library,  Build B = Console App (referencing Class Library in Build A)

Step 1 – Creating the Nuget Package Artifact  (Build A – Class Library)

We need to make the class library DLL available as a nuget package.  This can then be referenced through TeamCity’s Nuget server.

1.1   Create a new Build Step “Pack Class Assembly” – This should be the final step after the unit tests have passed.

tc4

1.2          Create a new “Snapshot Dependency” in the Console App (Build B).

tcsd

1.3  Create a new build step on Console App (Build B) for the Nuget installer.

tc1

1.4 Authenticate Nuget feed

tc2

If your private Nuget feed requires credentials Nuget has a handy “Build Feature” that you can add to any project that requires access. Note that the user account should really be a service account.

1.5 Bring the Nuget feed into Visual Studio

Finally, it’s advisable to include the Nuget server location into Visual Studio to acquire the published assembly into any project that needs to reference it – This will be the same as the variable %teamcity.nuget.feed.auth.server%.  For example

tc3

Advertisements

Leave a comment

Filed under Comps

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s