Hi!
I have a msbuild project file that I'm using with desktopbuild+teambuild.
It's building a VS.Net solution file with both debug + release configurations.
I
have a couple of <AdditionalReferencePath> items defined to solve
file based assembly references in the projects of the solution.
My problem is that I want to use different paths depending on what configuration that is used.
So
for example, what I want to do is to make the build of the release
configuration refer to \thirdpartycomponents\release, and the debug
configuration to \thirdpartycomponents\debug.
Any clues
Thanks.
- Johan
Developer
RemoteX Technologies

Configuration aware AdditionalReferencePaths
Gizmoguy
What I tried to do was:
<AdditionalReferencePath Condition="'%(ConfigurationToBuild.Flavor)' == 'Debug'" Include="...search path...\Debug"/>
<AdditionalReferencePath Condition="'%(ConfigurationToBuild.Flavor)' == 'Release'" Include="...search path...\Release"/>
Which I hoped would give the MSBuild task different search paths for my items:
<ConfigurationToBuild Include="Release|Any CPU">
<FlavorToBuild>Release</FlavorToBuild>
<PlatformToBuild>Any CPU</PlatformToBuild>
</ConfigurationToBuild>
<ConfigurationToBuild Include="Debug|Any CPU">
<FlavorToBuild>Debug</FlavorToBuild>
<PlatformToBuild>Any CPU</PlatformToBuild>
</ConfigurationToBuild>
The reason why this isn't working is because the MSBuild task in Microsoft.TeamFoundation.Build.targets is called only once for all (VS.Net solution file defined) configurations that is to be built.
This results with that I get either the Release or the Debug, not one per configuration, referenced when I build (depending on if I use /p:Configuration=Debug or /p:Configuration=Release, when using your example).
Hm, I feel pretty stuck here. This problem exists when building inside visual studio as well (due to the lack of configuration dependent hint paths ;)), so maybe the Microsoft.TeamFoundation.Build.targets neither is designed for this scenario
What I'm thinking of is if I need to make my own "Build Vs.Net solution file"-target that supports this requirement.
The solution seems pretty simple though; It might work if I just do some sort of loop that invokes the MSBuild task once for every configuration to build in the solution file. Then I can supply different different sets of references to each command, i.e. @(AdditionalReferencePathDebug) and @(AdditionalReferencePathRelease).
Thanks.
Cheers,
Johan Andersson
namnguyen
And I'm afraid that my suggested solution is the way to go to accomplish this, after a quick look in the Microsoft common and Team Build target files.
Thanks.
- Johan
Cindy006
Sure. You can add a Condition="" to the AdditionalReferencePath definition in the project file. It would look something like:
Condition="'$(Configuration)'=='Debug'"
Put two entries in your file, one with the debug condition, one for the release condition, and that should do the trick.
Neil
g.ursula
Just wanted to clarify, are you saying that you would like to build both a debug and release at the same time and have the release portion of the build use the release references and have the debug portion use the debug references
If you want to do that I think you will need to make your own target file and do as you said above, calling the msbuild task for your configurations.