ClickOnce Deployment Via Command Line with makecert

by sondlerd
AddThis Social Bookmark Button

11. September 2007 14:04

Basic steps for ClickOnce deployment via a network share (no .deploy files):

1.    Create the file structure: trunk3.0\Deployment\1.0.1.25\bin

2.    Copy all files from the build folder Debug\bin folder into the newly created trunk3.0\Deployment\1.0.1.25\bin

3.    Remember to copy the icon file into trunk3.0\Deployment\1.0.1.25\bin

4.    Remove all the junk in main and sub folders (.deploy, .vshost or .pdb)

5.    Delete the clientShell.application

6.    Open the visual studio command prompt to the root of the Deployment folder (cd C:\test\trunk3.0\Deployment\), change the version number to current version and run:

                 mage -New Application -ToFile 1.0.1.25\bin\ClientShell.manifest  -Version 1.0.1.25 -FromDirectory 1.0.1.25\bin\ -       TrustLevel FullTrust

7.    (Optional) If you do not have a pvk file and a Cert

             -make an x509 certificate and private key(using pa$$word as the password when prompted):     

                 makecert company_cert.cer -sv companyprikey.pvk -in CertBag   

             -make the Private Key Exchange (pvk) file for signing the application manifest:     

                  pvk2pfx.exe -pvk companyprikey.pvk -spc company_cert.cer -pfx companyPFX.pfx -po pa$$word

8.    Append the .deploy suffix onto all files except the manifest files (rememeber to change directories to the deploymen DIR cd C:\test\trunk3.0\Deployment\1.0.1.25\bin):

Change the file names to include the .deploy extension (must do this in sub folders also)
rename *.* *.*.deploy

Manifest file need to lose the .deploy extension:
rename *.manifest.deploy *.

9.    Sign the application manifest with your digital certificate (note: modapri.pfx must be in the   same dir or change it and specify below):

             mage -Sign 1.0.1.25\bin\ClientShell.manifest -CertFile companyPFX.pfx -Password pa$$word

10.  Generate the deployment manifest with a call to Mage.exe OR Update the existing Deployment Manifest (2nd and nth time for deployment) 

             For first time only: 

          mage -New Deployment -ToFile ClientShell.application -Name "ClientShell" -Version 1.0.1.25 -AppManifest 1.0.1.25\bin\ClientShell.manifest -providerUrl http://WebServerName/ApplicationName/ClientShell.application

     Update (For each updated deployment):

          mage -Update ClientShell.application -Version 1.0.1.25 -AppManifest 1.0.1.25\bin\ClientShell.manifest -Install true

11.  Sign the deployment manifest with your certificate:

         mage -Sign ClientShell.application -CertFile companyPFX.pfx -Password pa$$word

12.  Copy all of the files in the current directory—including the version folder and the \bin folder—to the deployment destination. This may be either a folder on a Web site or FTP site, a file share, or a CD.

 13. You are now ready to script the deployment into an MS Build script.

Be aware that if you create a certification on your server you can run into issues with your personal webserver due to expired certificates on your system.  I spent some amount of time finding the cause of this security issue.

Here is a screen shot of MageUI.exe
- you can pull it up via the Visual Studio command line with "mageui.exe"

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , , , , ,

General | ClickOnce | makecert | msbuild | pvk2pfx | x509 certificate | mageui

Powered by BlogEngine.NET 1.1.0.7
Theme by Mads Kristensen

Robert D. Sondles

Name of author Robert Sondles
is an independent software engineer operating under his company named Blueberry Island Media ltd. He started the company in 2003 and has been developing softare with .Net since 2002. He is located in Philadelphia, PA..

E-mail me Send mail

Calendar

<<  November 2008  >>
MoTuWeThFrSaSu
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

View posts in large calendar

Recent comments

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008

Sign in