4

Newbie question : I have 2 C# projects in TeamCity, call them A and B. A contains a reference to B.dll. B builds fine. However, A fails to build because it cannot find B : Could not locate the assembly "B"

It seems really simple : how do I tell my project A on the buildserver where to find the binaries from B\bin\Release?

Aidan
  • 4,783
  • 5
  • 34
  • 58

2 Answers2

14

You do this by creating 'Artifacts' and artifact dependencies.

If project A is dependent on project B, then you create an Artifact on project B using an artifact path like so:

bin/Release/B.dll

Then on project A you setup a artifact dependency on B with path like:

B.dll

And set the destination path to be where ever project A is expecting to find B.dll e.g.

./Libs

You can do other cool stuff like automatically archiving all your artifacts into a zip by using the syntax:

bin/Release/*.dll => B.zip

and access them via:

B.zip!B.dll

All these paths are relative to build directories so makes it easy and you dont need to worry about the TeamCity guid folders or use absolute paths.

Jack Ukleja
  • 13,061
  • 11
  • 72
  • 113
0

The problem you're encountering is that Teamcity runs each build in it's own temporary directory and since this is a randomly generated name you can't set a reference directly from one to the other.

Typically you would write a build script that builds both A and B in the right order and just have Teamcity run that build script. (Since you're using C#, MSBuild is ideal for this).

The alternative would be to have B.dll copied to a known location (e.g. c:\currentbuild) at the end of its build and have A always reference it from here. You can set up build dependencies in Teamcity so that if B is rebuilt, A is also rebuilt.

Paolo
  • 22,188
  • 6
  • 42
  • 49
  • Thanks for that answer, I can see the temp directories on the server, and I can create a Build Chain by adding a snapshot dependency. If I could just tell the snapshot to copy the binaries from B into the directory A is expecting, all would be well. Is there no way of doing that? Surely there must be? – Aidan Jun 04 '10 at 09:19
  • No, I don't think there is. That is why you should write a build script for TeamCity to execute. – Paolo Jun 04 '10 at 17:45