Question: I publish my exe and activate auto updates.

But when I compile the exe, there is an error:

> 
> Severity Code Description Project File Line Suppression State Error An
>  error occurred while signing: Failed to sign
>  bin\Debug\app.publish\myapp.exe. SignTool Error: Invalid option: /fd
> 
> 
> 

So I couldn't publish.

When I try to uncheck "Sign the ClickOnce manifest" the error is gone
but I couldn't install the package because Windows doesn't allow and the Windows Defender SmartScreen blocks my app because there's no certificate.

I have to add a certificate from "Sign the ClickOnce manifest" but now it gives the "SignTool Error: Invalid option: /fd" error.

How can I solve this problem?

Answer: 
I had to change the Signature Algorithm to sha1RSA from sha256RSA
I encountered the same error message when migrating an old ClickOnce project from VS2018 to VS2017. It seems my VS2018 was using an old version of SignTool. 

I found (and succeeded with) a tip to change registry key HKEY\_LOCAL\_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows to make Windows to use newer SDK (in my situation SDK v8.1A was the most recent).

The original tip can be found here: <https://social.msdn.microsoft.com/Forums/en-US/a39b9f82-aaec-4bbd-8cb2-3cade50796ba/an-error-occurred-while-signing-failed-to-sign-bindebugapppublishprogramexe-signtool-error> (scroll down to answer by nikidimi)