*rubbing eyes* in MSBuild, what is the difference between DependsOnTargets and AfterTargets? Isn't that the same thing?
@sundew OK. In that case, is BeforeTargets different from DependsOnTargets
So I feel like this has happened to me nine times, in three different build systems, and I'm so tired.
We have an MSBuild project. It has targets A,B,C,D. Target D has an AfterTargets="A;B;C" in its xml.
When we run the project, we visibly see in the output window that the targets run in the order C;D;A;B. Moreover, the output of D is incorrect, as if D had been run without A and B having run first.
Why. Why. Why. Why. Why.
How do I convince MSBuild to do what I tell it to.
Related questions which I do not expect you to have an answer to.
1. Is this relevant? I think no, because it relates to MSBuild being told to build multiple project files in parallel, and our current problem concerns targets run potentially in parallel?
https://github.com/dotnet/msbuild/issues/11784
2. There's a <ZipDirectory> task in MSBuild. We in fact want our MSBuild to create a zip. But we want a 0-compression zip, which ZipDirectory lacks as an option.
How would you attack this problem? Must work on WIndows
@mcc if target A has AfterTargets="B" then running B will also run A afterwards, if target A has DependsOnTargets="B" then running A will also run B first
@mcc As I understand it, they are close to the inverse of each other.
Thinking in terms of what triggers what:
"AfterTargets" will trigger the target you're defining when _they_ are built, but you can build the target you're defining without triggering them.
"DependsOnTargets" are triggered before the target _you're defining_ is built, but your target won't always be triggered if they are.