Hi, I want to use CCNetRequestSource wich is the name of the trigger wich launch the Msbuild task. For exemple when "toto" trigger is exected i want to launch the "toto" target on MsBuild. Is it possible ? It's for a nightly build, i want to create MSI file and doc at this time, i created the specific target in MSBuild but i don't found how to execute it only when a specific trigger is throw.
+1
A:
There is msbuild syntax that should help you with this. Take a look at the following links:
- MSBuild Task - To run another project
- Conditional Constructs in MSBuild - to allow you to choose between different project configurations
You should try adding a facade build file for CruiseControl to call that will delegate to your solution files with a construct similar to the following:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Choose>
<!-- If the toto CCNETRequestSource was submitted -->
<When Condition="'$(CCNetRequestSource)'=='toto'">
<PropertyGroup>
<Target Name="toto">
<MSBuild Projects="MyProject.sln" Properties="Configuration=Debug" Targets="toto" />
</Target>
</PropertyGroup>
</When>
<Otherwise><!-- Place your standard build call here --></Otherwise>
</Choose>
</Target>
</Project>
Jeff Fritz
2009-04-21 12:02:01
Thanks :) finally I found an other way by myself but your answer should be good too :)
LoKtO
2009-04-23 09:46:44
Can you share technique you found? I'm curious how you solved this... This was a good problem to solve
Jeff Fritz
2009-04-23 11:16:44
A:
I make it like this :
<Project DefaultTargets="Integration" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition="'$(CCNetBuildCondition)' == 'ForceBuild'">Release</Configuration>
<Configuration Condition="'$(CCNetBuildCondition)' != 'ForceBuild'">Debug</Configuration>
</PropertyGroup>
<Target Name="Integration" DependsOnTargets="ConstruireSolution;FaireDoc">
</Target>
<Target Name="ConstruireSolution" >
<!-- with first build -->
<MSBuild Projects="MyBuild.sln" Properties="Configuration=$(Configuration)" Targets="Clean;Rebuild" />
</Target>
<Target Name="FaireDoc" Condition=" '$(CCNetRequestSource)' =='FaireDoc'">
<!--Build to add when FaireDoc trigger is fired -->
<MSBuild Projects="C:\CI\Plateforme\Documentation\Doc.shfbproj" Targets="Build" />
</Target>
I choose this solution because i always need the first build :) the second target is a sandcastle project to lunch only at night :)
LoKtO
2009-04-23 12:12:12