views:

13

answers:

1

Hi,

I am building various projects using the <MSBuild Projects="... markup. I am then executing some command line tools after the project is built.

E.g

<Target Name="Name">
    <MSBuild Projects="" />
    <Exec Command="" />
</Target>

I notice that the project is only built as required and get the following output when the build script is run: "Skipping target "CoreCompile" because all output files are up-to-date". This is great but how do I make my <Exec... commands use the same condition so that they are only run when necessary as well?

Thanks for any tips.

Alan

A: 

You should be able to use the TargetOutputs parameter:

<MSBuild Projects="" >
   <Output TaskParameter="TargetOutputs" ItemName="AssembliesBuiltByChildProjects" />
</MSBuild>
<Message Text="Assemblies built: @(AssembliesBuiltByChildProjects)" /> <!-- just for debug -->
<Exec Command="" Condition="'@(AssembliesBuiltByChildProjects)'!=''" />
gregmac