I have after.solution.sln.targets with a beforeBuild and an afterBuild. Works fine if i use msbuild from the commandline.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003" InitialTargets="BeforeBuild">
<Target Name="BeforeBuild">
<Message Text="Initializing the Before BUILD" Importance="High"/>
<!-- existing line, not part of answer -->
<Exec Command="C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -executionpolicy Unrestricted -command "& { .\PreBuild.ps1 } "" LogStandardErrorAsError="True" ContinueOnError="False" />
</Target>
<Target Name="AfterBuild" AfterTargets="Build;Rebuild">
<Message Text="Initializing the After BUILD" Importance="high"></Message>
<Exec Command="C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -executionpolicy Unrestricted -command "& { .\PostBuild.ps1 } "" LogStandardErrorAsError="True" ContinueOnError="False" />
<!-- We get here still before the build, not after, because this whole targets file is executed before the build. -->
</Target>
<!-- All four standard targets must be present, otherwise VS barfs. -->
<Target Name="Build">
<Message Text="Solution Build target" Importance="High"/>
</Target>
<Target Name="Rebuild">
<Message Text="Solution Rebuild target" Importance="High"/>
</Target>
<Target Name="Clean">
</Target>
<Target Name="Publish">
</Target>
</Project>
In VisualStudio with the extension loads both the Before and the Afterbuild before the build...