In order to install a certificate (.cer) file required by Microsoft Office 2010 on the target computer the CertMgr.exe tool is required. The installation of the certificate file will be done by using a custom action.
The CertMgr.exe tool is available in Windows SDK and can be downloaded from the Microsoft website.
Add the certificate
Add the certificate file to the project in the Files and Folders Page. The CertMgr.exe tool is not required to be added to the project.
Create the custom action
Navigate to the Custom Actions Page and select the Add Resources action group.
- From the list of predefined custom actions visible in the upper side of the page select the "Launch attached file" action, using the button "Add custom action with sequence". In the opened dialog navigate and select the CertMgr.exe file.
- Using the properties pane on the right select the options When the system is being modified (deferred) and Run under the LocalSystem account with full privileges (no impersonation) for your recently added custom action.
- In the "Command Line" field write the following code:
-add -all "[#MyCertificate.cer]" -r localMachine TrustedPublisherName
- Replace MyCertificate.cer with the actual name of your certificate file.
It is mandatory to specify the file reference ([#MyCertificate.cer]) by actually selecting the file in your project. To do that right click in the "Command Line" field and from the context menu that appears select "File" entry, then pick your certificate file.
Add the rest of your application files, build and test the project.