Skip to content

Instantly share code, notes, and snippets.

@benvillalobos
Last active October 6, 2022 17:52
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save benvillalobos/36728a3106fae23b7c98865b436e9e19 to your computer and use it in GitHub Desktop.
MSBuild Target Ordering Best Practices

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment