Friday, May 22, 2009

How to publish a ClickOnce Application without Visual Studio

When i search a solution for the question “How to change .exe.config.deploy”, i cannot have a good answer. So, i try to create my solution and it is successful.

In this solution, you can deploy a ClickOnce Application to customer’s server, it execute with requests:

  • Modify config in app.config, example: Connection String, Web Reference URL,…
  • Change start location of a signed ClickOnce Application.
  • Change Version of product.
  • Publish application without VS and .NET Framework SDK.
1. Create necessary files for ClickOnce Server

        To publish the ClickOnce Application to a server, you must have necessary files includes: MyApp.application (my application sample is MyApp), index.html and setup.exe.

        Open the source code in Visual Studio and publish ClickOnce Application to local IIS . Next, open  publish folder (C:\Inetpub\wwwroot\MyApp) and copy only files MyApp.application, index.html and setup.exe to the deployment folder (MyAppClickOnce). This folder will be provided the customer who will publish application to his server.

  2. Copy the contents of the application to the deployment folder

       Copy the contents of the application from the build output folder (bin\Release) to folder’s name [ApplicationName_Version(a_b_c_d)] to the deployment folder (MyAppClickOnce\MyApp_1_0_0_0).

       Copy the publisher certificate that was generated by Visual Studio when you first published to the deployment folder.

       Open folder [Microsoft Visual Studio 8]\SDK\v2.0\Bin and copy file mageui.exe  to the deployment folder.

       Now, you can compress the deployment folder to your customer with install guide and he should be install a ClickOnce Application without Visual Studio and .NET Framework SDK 2.0.

3. Publish application
  • Open mageui.exe, on menu File –> New –> Application Manifest.
  • In the tab “app1.exe.manifest”, select “Name” from list in the left, input name of application into Name textbox  (MyApp) and Version textbox (1.0.0.0).
  • In the tab “app1.exe.manifest”, select “Files” from list in the left,
    • At “Application directory:”, select folder containing the application files (MyApp_1_0_0_0) .
    • Click check on checkbox “When populating add the .deploy extension to any files that does not have it”.
    • Click button “Populate”.
  • On menu of mageui, select File –> Save.
    • In the screen “Signing Options”, select option “Sign with certificate file”, click button […] to select publisher certificate. Click OK to next.
    • In the screen “Save As”, save with default file name to folder containing application files (MyApp_1_0_0_0).
  • On menu of mageui, select File –> Open.
  • Select file MyApp.application in the deployment folder.
  • In the tab “MyApp.application”, select “Name” from list in the left, change Version to 1.0.0.0
  • In the tab “MyApp.application”, select “Deployment Options”, modify “Start Location” to new path or url of the current server.
  • In the tab “MyApp.application”, select “Application Reference”, click button “Select Manifest…” to select file manifest that is created above.
  • On menu of mageui, select File –> Save.
  • In the screen “Signing Options”, select option “Sign with certificate file”, click button […] to select publisher certificate. Click OK to save.

Now, you can install ClickOnce Application from new location.

P.S: I am sorry about my English. :)

No comments:

Post a Comment