views:

1669

answers:

2

I'm trying to get MSBuild working on a project that has just been moved to TFS2008. The solution was huge, so it was split into 5 team projects, A-E. Each one has only one solution but several projects. A is relient on B-E being built first. We need to build both debug and release versions of everything, which is fine, but when we compile A in release mode it uses the debug versions of B-E. Having looked in the proj files of the projects in A, their assembly references have been set to point to the debug versions of the libraries in B-E. Is there any way using an MSBuild proj file to make the release of A reference the release versions of projects in B-E? So far i've tried adding
<PropertyGroup>
<AssemblySearchPaths>
$(Configuration)
$(AssemblySearchPaths)
</AssemblySearchPaths>
</PropertyGroup>
to the MSBuild proj file, but it doesn't make any difference. Any suggestions?

+1  A: 

I think you can do this:

<PropertyGroup>
    <SomeReferencePath>..\Your\Other\Build\Path\</LibraryReference>
</PropertyGroup>
Then include this in the target:
Properties="ReferencePath=$(SomeReferencePath)"
That will instruct the compiler to look in that reference path to resolve it's referenced assemblies.

I think =:)

[Edit: this would all go within a new msbuild script that builds all your sub projects.]

Simon P Stevens
Ahh. Hang on, you're talking about the .proj files. Sorry. What I would do do is create a new msbuild script that builds all of the projects. You can do this by having a target for each project you want built. You would then set the reference path on each target for each project. Like I've put in this answer. (I've also posted another answer for another possible way of doing it which you might prefer)
Simon P Stevens
@Barn: Hey, you deleted your comment. Now I just feel like I'm talking to myself. =:) Hmm... Perhaps I am... Me... Crazy... Nah...
Simon P Stevens
+2  A: 
Simon P Stevens