I am wanting to run the same task on multiple projects from one build file without having to copy the task to each project file.
I am getting all project files in my solution and:
<ItemGroup>
<ProjectsToBuild Include="..\Modules\**\*csproj"/>
</ItemGroup>
I am then calling the MSBuild task on each ProjectToBuild
<MSBuild Projects ="@(ProjectsToBuild)"
Targets="DoStuff"
ContinueOnError ="false"
Properties="Configuration=$(Configuration)">
<Output ItemName="OutputFiles" TaskParameter="TargetOutputs"/>
</MSBuild>
This doesn't work, as the Target must exist in the project you are building.
From MSDN
The targets must occur in all the project files. If they do not, a build error occurs.
Is there a way I can pass the DoStuff task to the projects that are being passed into the MSBuild task?