views:

298

answers:

2

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:

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"&gt;
    <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
Thanks :) finally I found an other way by myself but your answer should be good too :)
LoKtO
Can you share technique you found? I'm curious how you solved this... This was a good problem to solve
Jeff Fritz
A: 

I make it like this :

            <Project DefaultTargets="Integration" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
        <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