views:

260

answers:

2

I have a build process that does the following:

  1. Runs TLBIMP on a number (say 10) of COM DLLs (a named group of TaskItems). This is my "Import" target that uses the Exec task.
  2. Runs ILDASM on the 10 interop assemblies. This is my "Disassemble" target that uses the Exec task.
  3. Runs a custom task to take all of the 10 IL files at the same time and do some work on them (details not important, but it's crucial that ALL 10 IL files are processed together by this task). This is my "Work" target.
  4. Reassembles the 10 IL files using ILASM, back into 10 DLLs. This is my "Assemble" target, uses the Exec task.
  5. Runs ILMerge to merge the 10 assemblies into one. This is my "Merge" target, uses the Exec task.

Everything's fine and dandy when I do a clean rebuild. When I do an incremental build, and just a few of the original COM DLLs have changed, MSBuild quite correctly only does partial builds of the appropriate targets, for the Outputs that are actually out-of-date with respect to their Inputs.

Is there a way that I can "force" MSBuild, for just one target (step 3 above), to run a Task passing ALL inputs instead of just the out-of-date ones? I don't want to change the code of my custom Task to hard-code the file names, I'd like them to be provided as TaskItems from the MSBuild script, but my custom task must be given ALL of the inputs derived from the original TaskItem group of COM DLLs, not just the ones that were rebuilt with this particular build.

A: 

I think I've found a way. I can define a group thus:

  <ItemGroup>
    <PrelimIL Include="$(IntermediateOutputPath)intermediate\*.il"/>
  </ItemGroup>

And then in my "Disassemble" target, have a second task:

<Touch Files="@(PrelimIL)" />
Wayne
A: 

You seem to be on the right track with touching the files before your target is executed. Since the input files have been modified (by your touch) more recently then all the outputs the target is completly rebuilt. Another approach you can do is to create a target, i.e. CleanIntFiles, which would delete those files. Then you can place that target onto the BeforeBuildDependsOn property.

For more info about how to extend that property take a look at my article Inside MSBuild.

Sayed Ibrahim Hashimi