If your target is influenced by file state or properties defined/modified by other targets. If so, you have a dependency
AfterTargets || BeforeTargets: ANY TIME x target runs, then run this target.
Beforetargets = publish is effectively equivalent to going over to publish and setting its dependsontargets=publishcontainers.
DependsOnTargets exists for targets that KNOW what they depend on when they are created.
BeforeTargets & AfterTargets are built for targets that were created AFTER certain targets, but need to hook in at specific points