So I actually just lifted this little snippet about installing ClickOnce certificates on TeamCity from another blog by Laurent Kempé. Unfortunately it appears to have gone offline for good, but thanks to the power of Google Cache I was able to bring it back from the dead and re-record it here for (hopefully) posterity.
Just recently I discovered that ClickOnce had been turned on for the project of one of our WebJobs. The certificate had expired and it was failing the build, both on my development machine and on our TeamCity server. I’m not sure if it is actually needed for WebJob deployments to production environments, but I decided to replace it and just figure that out later. Easily done in Visual Studio using the “Create Test Certificate” button under the Signing tab in the project properties. In actual fact, this is all that had been done by the original developer, so I’m okay with figuring out what should be done later for now.
I checked in the project changes to Git, including the new PFX certificate Visual Studio created. But nothing changed, the build was still failing with “error MSB3323: Unable to find manifest signing certificate in the certificate store”. The following are the steps I took per the advice in Laurent’s blog post (this assumes TeamCity is running under the Local System account.
- Download PsExec from Windows Sysinternals.
- Open a command prompt, and enter the following. It will spawn a new command prompt, running as Local System:
> psexec.exe -i -s cmd.exe
- In this new command prompt, change to the directory containing the certificate and enter the filename to install:
- The Import Certificate wizard will start up. Click through and select all the suggested defaults.
- Run the build.