Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > mage -sign via command line is unable to open certificate
 

mage -sign via command line is unable to open certificate

This was supposed to be the easy part!

Using VS2008, trying to deploy my app using ClickOnce and specifically following "Creating ClickOnce Applications for Others to Deploy" at http://msdn.microsoft.com/en-us/library/bb384248.aspx(and related "Walkthrough: Manually Deploying a ClickOnce Application that Does Not Require Re-Signing and that Preserves Branding Information" at http://msdn.microsoft.com/en-us/library/bb384248.aspx)

The series of commands shown below (steps 9 & 10 of the walkthrough) result in an error from MAGE.

makecert -r -pe -n "CN=Adventure Works" -sv MyCert.pvk MyCert.cer
pvk2pfx.exe -pvk MyCert.pvk -spc MyCert.cer -pfx MyCert.pfx

mage -s sfDash.application -cf MyCert.pfx

Unable to open certificate "MyCert.pfx":
The specified network password is not correct.

The error is the same:

  • On two machines (both Win XP with both VS 2005 and VS2008).
  • With the .application and .pfxin the same work folder on a local HDD and with a short path (d:\temp\ws)
  • Whether or not my pvk is protected by a password
  • Various file names and values for CN=

I've searched, but found nothing about this error...any pointers?

Stan York  Monday, May 12, 2008 6:41 PM

Seems that you forgot pvk2pfx option -po (pfx-pswd) - PFX password. It is same as -pi (pvk-password) but if-pi is given neither, then I get such error. After giving -po to pvk2pfx mage signs manifestswithout problems.

  • Marked As Answer byStan York Thursday, August 20, 2009 12:12 PM
  •  
Neeme  Tuesday, July 29, 2008 7:29 AM

Are you specifying the password for the certificate? Can you do that w/Mage?

Is the certificate already attached to the project?Try going into the Signing tab under the main project's properties and check "Sign the ClickOnce manifests" and select that one from a file. Then maybe it will mage it.

RobinS.

GoldMail.com

  • Unmarked As Answer byStan York Thursday, August 20, 2009 12:12 PM
  •  
RobinDotNet  Wednesday, May 14, 2008 1:21 AM

Seems that you forgot pvk2pfx option -po (pfx-pswd) - PFX password. It is same as -pi (pvk-password) but if-pi is given neither, then I get such error. After giving -po to pvk2pfx mage signs manifestswithout problems.

  • Marked As Answer byStan York Thursday, August 20, 2009 12:12 PM
  •  
Neeme  Tuesday, July 29, 2008 7:29 AM
I find out one strange think. If you will skip -pfx switch for pvk2pfx.exe then it will popup export key dialog. If you pass through all steps there then pfx file will be created. And mage.exe does not shows any error when using this key. Seems to me it is amazing. But it is ok for me since I am not going go generate keys for every publish. I am happy with one. So I can generate key manually and then use it duiring automated builds.
Shtin  Wednesday, January 28, 2009 6:23 PM

Thanks! I finally came back around to this and using your hint changed the second command line to

pvk2pfx.exe -pvk MyCert.pvk -spc MyCert.cer -pfx MyCert.pfx -po DumbPW

then i added -password DumbPW to the MAGE command line and all is well

So...if you use pvk2pfx in wizard (dialog) mode it creates a PFX with truly no PW, but if you use the command line, you apparently need a password. I tried -po followed by end-of-line and -po "" to get the equivalent of truly no password.

Someone at Microsoft should update the articles on "Creating ClickOnce Applications for Others to Deploy"....

Stan York  Thursday, August 20, 2009 12:18 PM

You can use google to search for other answers

Custom Search

More Threads

• Smart device deployment with resource files
• Application Updater block and BITS
• Programatically change install path
• Customizing the click once UI while installing the application
• Installing content of folder in specified location
• Adding desktop and other shortcuts to an msi install
• Creating a Desktop Shortcut for the application, enabling dropping of files onto it.
• how to script click once component
• dll.config file
• Bizzare error while running exe after installation