views:

40

answers:

2

I'm setting up TeamCity to build some solutions whose projects have an OutputPath directive that redirects the build to ../../bin/Release or ../../bin/Debug. The solutions obviously build fine in Visual Studio 2008 but when TeamCity builds the solutions it fails to find the assemblies of referenced projects and we get namespace errors (The type or namespace name 'SomeReferencedAssembly' does not exist in the namespace 'AssemblyBeingBuilt').

Is there a way to tell TeamCity where to look for referenced projects whose assemblies are not in the default location? It does understand the directive because when it builds the referenced project, the output is directed correctly. Its just that other projects it builds afterwards are not finding the assemblies they depend on.

+1  A: 

Are the unfound references 3rd party (code you don't compile), or your code?

If third party, then you want to make sure that the source control repository root you are pointing at at results in dependencies also being checked out. (or worse, putting them in GAC or installing them on each build server, not a good idea unless you have to)

If your code, are they build by a project in the same solution or a different one?

To the degree you can make one project dependent on another and then point the build at a solution, this is a good thing.

If 2 different solutions, then you have to use the Dependencies (section 5) to set up an Artifact dependencies.

MatthewMartin
It's all one solution and there is no third party stuff. The issue is that, all projects in the solution have their OutputPath directive (for all build configurations) set to "../../bin/$(Configuration)" instead of the default "bin/$(Configuration)". This means that the build output is dropped in a directory outside of the solution structure. VS copes fine with this and TC builds to the right OutputPath but then falls over when another project depends on one that has just been built and dropped to the OutputPath.
grenade
The dependent projects cant find the assemblies of the projects they depend on. I think the issue is that TC is just not designed to follow the OutputPath directive when resolving assembly references. I've raised a bug with TC and in the meantime I will try your artifact dependencies idea.
grenade
+1  A: 

Are you using the solution runner in teamcity? If so then the location of the references is specified in each csproj. You shouldn't need to do any additional configuration.

Verify that the references are project references rather than assembly references. An assembly reference may point to ../../bin/debug/assembly.dll which would not resolve when compiling in release.

You can look in the csproj to confirm, alternatively visual studio will only show the 'Specific version' dropdown in Properties for assembly references.

mattk