Not working for Visual Studio 2019 Version 16.11.0 Preview 4.0
<Target Name="CustomActionsBeforePublish" BeforeTargets="BeforePublish">
<Message Text="$(PackageName) BeforePublish" Importance="high" />
</Target>
<Target Name="CustomActionsAfterPublish" AfterTargets="AfterPublish">
<Message Text="$(PackageName) AfterPublish" Importance="high" />
</Target>
<Target Name="PostPublish" AfterTargets="Publish">
<Message Importance="high" Text="FINISH to Publish $(PackageName)" />
<Exec Command="ECHO PUBLISH to server" />
</Target>
Result:
------ Build started: Project: Mgft.Core.Cache, Configuration: Release Any CPU ------
FINISH to Build bin\Release\net5.0\Mgft.Core.Cache.1.0.0.0.nupkg
Done building project "Mgft.Core.Cache.csproj".
Successfully created package ..bin\Release\Mgft.Core.Cache.1.0.0.nupkg'.
Publish started: Project: Mgft.Core.Cache, Configuration: Release Any CPU ------
Successfully created package ...Mgft.Core.Cache.1.0.0.nupkg'.
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Publish: 1 succeeded, 0 failed, 0 skipped ==========