To illustrate how ClickOnce works, you will publish the Library Application (
LibraryApp) that you have written and see how easy it is to deploy it using a web server. Furthermore, ClickOnce has the added benefit of ensuring that applications that you deploy will automatically check for the latest update (you can configure the application to check every time before it runs, or check at regular time intervals) on the server, if one is available, as you'll see in "Automatic Updating," later in this capter.
You can now publish (deploy) a Windows application through a disk, shared folder, FTP server, or web server, and automatically ensure that users are always using the latest version of the application.
To run the ClickOnce Publish Wizard, go to Build → Publish LibraryApp on the Visual Studio menu, as shown in Figure 4-32. The "Where do you want to publish" dialog box will appear.
The "Where do you want to publish" dialog box gives you four options for where to publish the application: disk, shared folder, FTP server, or web server. For this project, you will publish the application through the IISweb server (see the sidebar "Installing IIS on Your Computer" on how to install IIS on your Windows XP computer).
In the "Specify the location to publish the application" text box, create a directory for the application by entering the following link: http://localhost/LibraryApp (see Figure 4-33). Click Next. The "Will the application be available offline?" dialog will appear.
ClickOnce allows the user to install an application locally on the client, or to download every time it is needed. In the "Will the application be available offline?" dialog, select "Yes," as shown in Figure 4-34, and then click Next. The "Ready to Publish!" dialog will appear.
That's it! You are now ready to publish the application from your web server. In the "Ready to Publish!" dialog shown in Figure 4-35, click Finish to create the web page that users will link to in order to install the application.
You should see the web page shown in Figure 4-36. Your users can now use the URL for that page to install the application on their own machines.
To install the application on your own machine, click the launch link in the page.
You will be prompted with a security warning such as the one shown in Figure 4-37. Click Install to install the application onto your machine.
You can eliminate this security warning by setting the relevant security policy. Refer to the MSDN Help Topic "Code Access Security for ClickOnce Applications" for more information. Also, check out the help topic "How to: Sign ClickOnce Application and Deployment Manifests" (http://msdn2.microsoft.com/library/che5h906(en-us,vs.80).aspx) for more information.
You will now see that the LibraryApp application is launched automatically. Alternatively, you can launch the LibraryApp application from Start → Programs → LibraryApp → LibraryApp.