Deployment


When you've got your application just how you like it, all arranged and responsive and fancy, 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 like, you can use the VS.NET Setup Project template to create a project that produces a Microsoft Setup Information (MSI) file containing your application's files. Recipients can use this MSI file to install the application into the folder of their choice.

Of course, 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 of 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. That deployment model has never been available out of the box for Windows applications. Until now.

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

  1. Using the Windows Application project template, create a project called DeploymentFun.

  2. Drag and drop some controls from the Toolbox, and compile your application.

  3. In the shell explorer, navigate to your DeploymentFun\bin folder and right-click on the Debug folder, choosing Properties.

  4. Choose Web Sharing and turn it on, using DeploymentFun as the name of the share.

  5. Using Start Run, enter the following URL:

    http://localhost/DeploymentFun/DeploymentFun.exe

You've just used the no-touch deployment feature of .NET to deploy your WinForms application like a Web application, except that it's a real Windows application complete with full user control over the frame, the toolbar, the menu bar, the status bar, shortcut keys, and so on. Any libraries that are required to make your application run, such as custom or third-party controls, will be downloaded from the same virtual directory that the application came from. And, just like a Web application, by default your WinForms application is running in a security sandbox. In the case of no-touch deployment applications, the sandbox is provided by .NET Code Access Security , which dictates that the permissions of your code are limited according to where the code came from, such as across the intranet. 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.

For the details of deploying WinForms applications and controls over the Webincluding hosting WinForms controls on a Web page, application deployment, versioning, caching, and most importantly, securityturn to Chapter 15: Web Deployment.



Windows Forms Programming in C#
Windows Forms Programming in C#
ISBN: 0321116208
EAN: 2147483647
Year: 2003
Pages: 136
Authors: Chris Sells

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