Although there are plenty of code signing and click once deployment questions out there, I could not find something that matches my scenario.
The setup.exe is signed properly, as it seems. When I execute it as an admin (to force UAC to appear), it shows publisher correctly on the pop-up window.
But when the setup takes place, then the famous "unknown publisher" appears:
My first question would be why publisher is unknown if setup.exe seems to signed:
My theory is that maybe there is something wrong with the application manifest, deployment manifest or application .exe signing.
Well, I have followed the steps in this article and added a build target istead of using the project properties sign UI:
<Target Name="SignManifest" AfterTargets="_DeploymentSignClickOnceDeployment" Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Exec Command=""C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\mage.exe" -Sign "$(_DeploymentApplicationDir)$(_DeploymentTargetApplicationManifestFileName)" -CertHash <hash> -TimeStampUri http://timestamp.comodoca.com/?td=sha256" />
<Exec Command=""C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\mage.exe" -Update "$(PublishDir)$(TargetDeployManifestFileName)" -AppManifest "$(_DeploymentApplicationDir)$(_DeploymentTargetApplicationManifestFileName)"" />
<Exec Command=""C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\mage.exe" -Sign "$(PublishDir)$(TargetDeployManifestFileName)" -CertHash <hash> -TimeStampUri http://timestamp.comodoca.com/?td=sha256" />
<Exec Command="..\..\..\Tools\signtool.exe sign /f "<mypfx.pfx>" /p password /fd sha256 /tr http://timestamp.comodoca.com/?td=sha256 /td sha256 /as /v "$(PublishDir)\setup.exe"" />
I also did the checks on the manifest properties recommended by this other thread, but still no results.
I have also tried to play with different signtool options, but no change.
I have also verified the signing by issuing signtool verify /v setup.exe. This is the answer (removed hashes in case this info is sensitive)
Regarding SHA1, it seems for code signing they are not deprecated. Besides, my app was signed with SHA256
I am running out of alternatives. Any ideas are very welcome!