In Visual Studio 2019, you can define events to be run after BUILD ("Post-build"), but can you define also an event after PUBLISH?
I am publishing a .net 5 single-file (Windows Desktop App), which is in fact an exe file. I want to digitally sign the exe with a tool before it is finally released. How can I automate this?
you can use msbuild target to execute a task after the project is published and invoke a command to sign you executable file.
edit you csproj file and add the following msbuild target
<Target Name="Sign" AfterTargets="Publish">
<Exec WorkingDirectory="$(PublishDir)" Command="{your signing tool command here}" />
</Target>
save your file and run dotnet publish the signing command will be executed after the publish is finished