Search code examples
c#clickoncesigningsigntool

How to sign ClickOnce application in Post Build Event?


I have WinForms application that are deployed through ClickOnce. I have Post Build Event that signs my assemblies with SignTool. I publish application as ClickOnce installer and I see in VS output that files are signed, but after install there is no signed assemblies. How I can sign assemblies that will be included to ClickOnce package?


Solution

  • Thanks to Mate

    Finally I did that! I added target to *.cproj file as mentioned in article here

    It looks like:

    <Target Name="AfterCompile">
    <Exec Command="&quot;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\SignTool.exe&quot; sign /f cert.pfx /p your_password /v &quot;$(ProjectDir)obj/$(ConfigurationName)/$(TargetFileName)&quot;" />
    </Target>
    

    There is signed *.exe file in the obj directory. Also I use AfterCompile target, because I had problems with application manifest when tryed BeforePublish target.