I have a custom msbuild task that is generating some output files to the output directory ($(TargetDir)) of a ProjectA. Current code is something like this:
As I understand you want to add additional step by writing only this line in ProjectB.msbuild:
To achieve it you can write something like in ProjectA:
$(BuildDependsOn);MyCustomTask
This adds your task to the list of dependencies of Build task.
Refer this question for details: StyleCop MS Build magic? Who is calling the StyleCop target?