I have a solution that contains a console (or Winform) application and I use Visual Studio publish to folder.
My problem is that we need to sign (certify) the *.EXE file. Currently I do that manually. I'm not using ClickOnce and no setup-project.
Is there a way to publish to folder and sign the resulting *.exe file at once?
Use "SignTool" to sign: https://learn.microsoft.com/en-us/dotnet/framework/tools/signtool-exe
Edit your *.csproj file and add code like this:
<Target Name="CustomAfterPublish" AfterTargets="Publish">
<Message Text="Sign Publish EXE" />
<Exec Command="call c:\SignTool\signtool.exe sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /f c:\YourSingFolder\YourCertificate.pfx $(PublishDir)$(TargetName).exe" />
</Target>
Some background information here: After Publish event in Visual Studio.