LoKtO
LoKtO

Reputation: 189

Choose a MSBuldTarget to launch with Cruisecontrol.Net

I want to use CCNetRequestSource which is the name of the trigger which launches the MSbuild task. For example when "toto" trigger is executed 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 thrown.

Upvotes: 1

Views: 667

Answers (2)

LoKtO
LoKtO

Reputation: 189

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 :)

Upvotes: 0

Jeff Fritz
Jeff Fritz

Reputation: 9861

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">
    <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>

Upvotes: 1

Related Questions