Created
June 24, 2020 20:22
-
-
Save brinko99/2bb84da5351403ab076d262d9d8487a4 to your computer and use it in GitHub Desktop.
MSBuild Target that checks if build occurred
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--Inpired by: https://stackoverflow.com/a/13849011/84522 --> | |
<Target Name="GetLastModifiedTime" BeforeTargets="BeforeBuild"> | |
<PropertyGroup> | |
<LastModifiedTime>%(IntermediateAssembly.ModifiedTime)</LastModifiedTime> | |
</PropertyGroup> | |
</Target> | |
<Target Name="CheckWasBuilt" AfterTargets="AfterBuild"> | |
<PropertyGroup> | |
<!--WasBuilt is true only if a build/rebuild occurred. Can be used as a condition on other Targets that only need | |
to run when after a build actually occurred. Those targets should be configured with: | |
AfterTargets="CheckWasBuilt", Condition="$(WasBuilt) --> | |
<WasBuilt>false</WasBuilt> | |
<WasBuilt Condition="%(IntermediateAssembly.ModifiedTime) != $(LastModifiedTime)">true</WasBuilt> | |
</PropertyGroup> | |
</Target> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment