I am working on a VSTO add-on for Excel which is signed. I don't know if this applies to your project type or situation.
Visual Studio doesn't actually sign the manifest using the pfx file. It signs it with a certificate that is in the Windows certificate store, which has the thumbprint in the ManifestCertificateThumbprint
property.
<PropertyGroup>
<ManifestKeyFile>some.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>...</ManifestCertificateThumbprint>
</PropertyGroup>
The ManifestKeyFile
is a hint to Visual Studio on where it can find the cert if it's not in the store.
When you create a new VSTO project, it does not contain either of these properties until the first time you build it. On this first build, Visual Studio pushes you into a workflow that creates a cert in the store, sets ManifestCertificateThumbprint
, exports the cert to a pfx file, and sets the ManifestKeyFile
hint to point to that file. Adding this project to source control causes the second dev to have a different workflow. For her, the ManifestCertificateThumbprint
is not in the cert store, so it uses the ManifestKeyFile
hint to locate the pfx file in the project, and install that cert to the store, which causes her to enter a password for the pfx file. After the cert is in the store, the pfx file is just cargo in the project.
This workflow is fine. Since it's a temporary, unprotected, local cert, it doesn't really matter if it is shared among devs.
What you might be looking for is this workflow: Use the Select from Store... option on the Signing tab of your project to choose the cert. It will remove the ManifestKeyFile
hint. When other devs get the project from source control, they will need to have the cert in their store already, so you can delete the PFX from the project. Essentially, creation and distribution of the temporary dev cert becomes a network admin problem, and not a dev/build problem. There are plenty of ways for admin types to push a cert into the stores of machines on the domain.
In either scenario, the real final production cert should be applied at the last minute of the build machine (after building with the temp dev cert) with a tool like Mage.exe (Manifest Generation and Editing Tool).