Create a Non-Expiring Test Certificate (pfx) for ClickOnce Applications

A ClickOnce application must be signed using a certificate. You can buy a real certificate or create a Test Certificate by your own. Visual Studio 2010 helps in creating such a Test Certificate. It offers a wizard and is very easy to use. The draw-back of the simple feature is that you can not do customization.

Create a Test Certificate in Visual Studio

Disadvantages of Visual Studio Test Certificate

If you want to deploy your application with such a Test Certificate you need to consider the following disadvantages:

  • “Issued To” and “Issued By” will contain the user name of your current windows account
  • “Expiration Date” is set to “Expires in one year”

Create a more customized Test Certificate (pfx)

If you want to create a more customized Test Certificate, you can do that by using the following script.

makecert -sv ClickOnceTestApp.pvk
         -n CN=Sample ClickOnceTestApp.cer
         -b 01/01/2012 -e 12/31/2100 -r
pvk2pfx -pvk "ClickOnceTestApp.pvk"
        -spc "ClickOnceTestApp.cer"
        -pfx "ClickOnceTestApp.pfx"

To learn more about the used tools
Makecert
http://msdn.microsoft.com/en-us/library/bfsktky3%28v=vs.80%29.aspx

Pvk2Pfx
http://msdn.microsoft.com/en-us/library/windows/hardware/ff550672%28v=vs.85%29.aspx

Add your Test Certificate to your Visual Studio Project

If you add your custom Test Certificate to your Visual Studio Project it will look like this.

Download the Script Sample

http://dl.dropbox.com/u/40751518/CodeSamples/MakeCert.zip

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: