How can I make MSBuild partially not create the target?
I have a build process that does the following:
- Launches TLBIMP on a number (say, 10) COM libraries (named group TaskItems). This is my Import target which uses the Exec task.
- Launches ILDASM on 10 communication sessions. This is my Disassembly target which uses the Exec task.
- Runs a custom task to take all 10 IL files at the same time and do some work on them (the details are not important, but it is important that all 10 IL files are processed together by this task). This is my goal "Work".
- Recovers 10 IL files using ILASM, back to 10 DLLs. This is my Build target, uses the Exec task.
- Launch ILMerge to merge 10 assemblies into one. This is my Merge target, uses the Exec task.
Everything is fine and dandy when I do a clean makeover. When I do an incremental build, and only some of the original COM libraries have changed, MSBuild quite correctly only partially builds the corresponding targets, for outputs that are actually deprecated in terms of their inputs.
Is there a way I can "force" MSBuild for one target (step 3 above) to run a task passing all inputs instead of the deprecated ones? I don't want to change my custom task code to hard-code the filenames, I would like them to be provided as TaskItems from an MSBuild script, but my custom task should be given ALL input received from the original TaskItem group from COM libraries DLLs, not just the ones that were rebuilt with that particular assembly.
a source to share
It seems that you are on the right track touching files before your goal is accomplished. Since the input files were changed (at your touch) quite recently, all the target's outputs are completely rebuilt. Another approach you can take is to create a goal i.e. CleanIntFiles , which will remove these files. Then you can place this target in the BeforeBuildDependsOn property .
For details on how to extend this property, see my Inside MSBuild article .
Ibrahim Hashimi said
My Book: Inside the Microsoft Build Engine: Using MSBuild and Team Foundation Build
a source to share