Using the Publish Wizard to Create a ClickOnce Application


You're now going to create a ClickOnce program that installs the Picture Viewer program you've been building throughout this book. Begin by opening the Picture Viewer project from Hour 20, "Working with Text Files and the Registry," and then follow these steps:

1.

Open the Build menu and choose Publish Picture Viewer. This displays the Publish Wizard shown in Figure 23.1. This page is used to specify where you want the ClickOnce file created.

Figure 23.1. The Publish Wizard is used to create ClickOnce programs.


2.

Specify the location for the ClickOnce install files. Be aware that you must enter a path that already exists; Visual C# does not create a path for you. If you specify an invalid path, you'll get a Build error at the end of the wizard. Notice the examples listed on this page; you can specify a file path, a file share, an ftp server, or a website. After you've supplied a valid path, click Next.

3.

On the next page of the Publishing Wizard, specify the method users will employ to install your program (see Figure 23.2). Although you can specify a website or UNC share, choose From a CD-ROM or DVD-ROM for this example and click Next.

Figure 23.2. Users can install your application in one of three ways.


4.

The next page of the Publishing Wizard asks you whether the application will check for updates (see Figure 23.3). If your application supports this feature, select the appropriate option button and specify a location where the update files will be placed. The Picture Viewer is a simple application and does not need this advanced functionality, so leave The Application Will Not Check for Updates option selected and click Next.

Figure 23.3. ClickOnce applications can update themselves if you design them to do so.


5.

The final page of the Publish Wizard is simply a confirmation page (see Figure 23.4). Verify that the information displayed is how you want it. Don't be concerned about the formatting applied to your path. Visual C# will modify it to create a valid UNC path. Click Finish to create the install.



Figure 23.4. Make sure that everything is correct before you finish the wizard.


When you click Finish, the Publishing Wizard creates the ClickOnce application and opens the folder containing the install files (see Figure 23.5). Notice how the version number of the application is used when naming files and folders. To distribute this application, you would simply burn the contents of this folder, including the sub-folder and its contents, to a CD-ROM or DVD-ROM and send it to a user.

Figure 23.5. These files (and the subfolder) make up the ClickOnce program.





Sams Teach Yourself Microsoft Visual C# 2005 in 24 Hours, Complete Starter Kit
Sams Teach Yourself Visual C# 2005 in 24 Hours, Complete Starter Kit
ISBN: 0672327406
EAN: 2147483647
Year: N/A
Pages: 248
Authors: James Foxall

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net