Deployment


When you have your application just the way you like it, all arranged and responsive and fancy-pants, you'll want to share it. You have several options. You can create an archive of your files and send them as an e-mail to your friends and family, from which they can extract the files into the folder of their choice and run your application. Or if you don't like providing user support because your friends and family inevitably have no idea what they're doing, you can use the VS05 Setup Project template to create a project that produces a Windows Installer (.msi) file containing your application's files. Recipients can use this .msi file to install the application into the desired folder.

The problem with both of these techniques is that as soon as you share your application, that's when you find the crushing bug that, when the moon is full and the sun is in the house of Orion, causes bad, bad things to happen. When problems come up, you need to remember who received your application so that you can let them know to install the new version before the existing version formats C: or resets your boss's Minesweeper high scores. Of course, all this explains why your IT department mandates that all internal applications be web applications.

The web application deployment model is so simple, there is no deployment. Instead, whenever users surf to the web application in the morning, they get the version that the IT department uploaded to the server the night before. This deployment model is now provided for Windows Forms applications, using a technology known as ClickOnce.

At this point, you should stop reading and try the following:

  1. Use the New Project dialog to create a new Windows Application called ClickOnceFun.

  2. In Solution Explorer, right-click the ClickOnceFun project and choose Publish.

  3. In the Publish Wizard, click the Finish button.

  4. On the web page that's opened, click the Install ClickOnceFun button.

  5. On the Application InstallSecurity Warning dialog, click the Install button.

  6. Bask in the glory of using ClickOnce deployment to publish and install a real Windows application over the web, without any setup required.

You've just used the ClickOnce deployment feature of .NET to deploy your Windows Forms application like a web application, except that it's a real Windows application complete with full user control over the frame, the tool strip, the menu strip, the status strip, shortcut keys, and so on. Any libraries your application requires, such as custom or third-party controls, will be downloaded from the same virtual directory that the application came from. When a ClickOnce-deployed application is downloaded, the .NET Framework's code access security dictates that the permissions of your code are limited according to the zone from which the application is deployed, such as the Internet, an intranet, or a local machine.

When applications require more permission than their zone allows, users have the option either to prevent the application from installing or to authorize permission elevation to allow the application to execute with increased permissions. This is in contrast to classic Windows security, where code is awarded permissions based on who launched the application, an approach that doesn't work very well when everyone seems to run as Administrator.

If that isn't enough security for you, ClickOnce-deployed applications are downloaded using a model built on trust certificates to identify application publishers; this model allows users to decide whether they should install an application based on whether they trust the application's publisher. If they trust a dodgy publisher and get burned, they have recourse; because the identity of the publisher is stored in the trust certificates themselves, and because trust certificates are handed out only by authorities certified to do so, such as VeriSign, users can be pretty confident in tracking down the perpetrator of any evil crimes that take place.[8]

[8] You can reach VeriSign at http://www.verisign.com.

Overall, ClickOnce deployment offers a slew of support for a wide variety of deployment scenarios that can be configured from VS05. Further, if your deployment needs aren't supported by VS05, you can use code to leverage the System.Deployment namespace to enable them. For the details, turn to Chapter 19: ClickOnce Deployment.




Windows Forms 2.0 Programming
Windows Forms 2.0 Programming (Microsoft .NET Development Series)
ISBN: 0321267966
EAN: 2147483647
Year: 2006
Pages: 216

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