After upgrading to a csproj to use Visual Studio 2017 and Microsoft.NET.Sdk, my "BeforeBuild" and "AfterBuild" targets are no longer running. My file looks like this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net46</TargetFramework>
</PropertyGroup>
<!-- my targets that don't run -->
<Target Name="BeforeBuild">
<Message Text="Should run before build" Importance="High" />
</Target>
<Target Name="AfterBuild">
<Message Text="Should run after build" Importance="High" />
</Target>
</Project>