Clickonce Deployment

Recently I had an opportunity to deploy a Desktop application which I was working on for few months into a production server. Microsoft has made the deployment procedure really simple and thus the name. But following the simple steps for the deployment may not succeed all the time(that is my experience). And that's why I sometime call it Click(More than) once deployment!! In general follow the steps as given below which consider some special conditions.

1) Right click the startup project properties. Clickonce deployment cannot be done without signing the manifest. Assembly signing is not required. In the Signing tab, the checkbox for Sign Clickonce manifest is automatically checked when you publish the app. The app is signed with a key (.pfx) created in the project.

2) Click Application Files to make sure all the files you need to be deployed in the project are present in the list. For ex, if you have added a .htm file somewhere in your solution, change its build action to Content. Since the startup project needs a link to this file to be deployed, add a link to the .htm file created in this project. To do this, click Add existing item in startup project. Select .htm file and click Add as link( a small arrow besides Add button).

Set the destination publish address(virtual directory). Click Publish Wizard to customize the folders if needed or Click Publish Now.

Some Caveats :

1) If prerequisites are required by your application, then proper bootstapper package need to be created for the same. To do this the quickest and cleanest way would be to use the Bootstrap Manifest generator. This creates the necessary files in the required location. You can find a step by step guide to use this tool here. Many other customizations could be done like adding Registry checks, file checks etc but those are not needed frequently. Restart VS editor and you should see the created package in the prerequisite list on the publish page. Select that and publish your project again.

2) Make sure that you have access to the virtual directory where you wish to publish this application. If for some reason you don't, publish them in some other folder where you have access and give this accessible folder's path to the virtual directory.

3) There is a publish.htm file created which by default is the starting page for the application. This is the page users will use to install the app. Make sure that the href value of the Install button is set to "setup.exe". Sometimes the value is set to the Application file which does not make sense since the whole reason for using clickonce is to bind the application and all other prerequisite packages into one file which is the executable "setup.exe".

4) There is a known bug in clickonce which I experienced too. On some machines which are used to deploy the application, once the app is published, clicking the RUN button on the publish page opens the setup dialog correctly but after that it opens a message dialog box with no text in it (wierd stuff!!). There is some discussion about this bug on this microsoft forum.

I have not covered the basics of this process assuming that you would know them. Although if you have any other questions, do leave a comment so that I can reply to it.

0 Comments:

Post a Comment