AfterBuild target will not be called if the assembly is not successful.
In $(MSBuildToolsPath)\Microsoft.Common.targetsit is defined as follows:
<PropertyGroup>
<BuildDependsOn>
BeforeBuild;
CoreBuild;
AfterBuild
</BuildDependsOn>
</PropertyGroup>
If the assembly fails ( CoreBuildtarget), AfterBuildit will not be called.
source
share