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:
When you specify Project Sdk="Microsoft.NET.Sdk"
, you are using "implicit top and bottom imports". This means there is an invisible Import to Microsoft.NET.Sdk/Sdk.targets at the bottom of your csproj file which is overriding the "BeforeBuild" and "AfterBuild" targets.
You can fix this by using explicit imports so you can control the import order.
net46