Tonight we got the following issue on our TeamCity build server which produce different ClickOnce setups :

c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(3652, 9): error MSB3482: An error occurred while signing: Failed to sign ....\Tests\Output\bin\DeployClickOnce\app.publish\setup.exe.

SignTool Error: ISignedCode::Sign returned error: 0x80880253 The signer’s certificate is not valid for signing.
SignTool Error: An error occurred while attempting to sign: ....\Tests\Output\bin\DeployClickOnce\app.publish\setup.exe

Checking the certificate used by our project I found that the expiration date was yesterday:

So I had first to create a new test certificate.

Then I had to re-install the certificate on the server, as described in “ClickOnce certificate and TeamCity”. Before installing I had to remove the old one using:

Psexec.exe -i -s cmd.exe

then running

mmc

and removing by hand the old certifcate.