1

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?

5
  • 1
    Read "#2: Signing the application executable post-build" --> robindotnet.wordpress.com/2013/02/24/… Commented Mar 12, 2015 at 0:05
  • I do exactly this, but files are not signed Commented Mar 12, 2015 at 2:36
  • 1
    Verify "obj" directory ( for VS2013 try "$(ProjectDir)obj\$(ConfigurationName)\$(TargetFileName)" ) and check the log on VS output view. Commented Mar 12, 2015 at 2:43
  • Thanks a lot! Finally I did that!!! You are right, the problem was because I signed assembly in bin/Release folder, not in obj! Also I set AfterCompile target, because I had problems with application manifest with BeforePublish target. Commented Mar 12, 2015 at 4:07
  • Great! Mark your answer as correct Commented Mar 12, 2015 at 18:33

2 Answers 2

5

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.

Sign up to request clarification or add additional context in comments.

Comments

0

This has been significantly easened in VS2022

Add a PFX to your Certificates store

1

Then add the following line to Post-Build Events 2

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.