I have a code generator tool that I partially own, and now that csproj files can list multiple Target Frameworks in them and building builds all of them, I am trying to figure o
On single target framework I only use BeforeTargets="PreBuildEvent":
netstandard2.0
on multi target frameworks I use BeforeTargets="DispatchToInnerBuilds"
netstandard2.0;net461
So my custom command is only exeuted once before every build. If you use InitialTargets, the command is executed more often than only once! For example if you save your project!