Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define an event after publish

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?

like image 715
askolotl Avatar asked Nov 20 '25 07:11

askolotl


1 Answers

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

like image 161
aamd Avatar answered Nov 21 '25 19:11

aamd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!