Installing Applications


Once you have built your application, you must install it on the computer on which it is to run. Of course, "installing an application" can mean different things to different applications. In general, you can use any of three different techniques for installing your application:

  • Copying files to the computer

  • Downloading files to the computer

  • Traditional installation programs that install files on to the computer

In some cases, an application may take advantage of more than one technique.

Copying Files to the Computer

Simple applications can be installed by copying the application files to the computer and running the application. Applications that use no external assemblies or only private assemblies are examples of such applications. All private assemblies and application configuration files exist either in the application directory or one of its subdirectories, meaning that everything needed for the application can be copied with one simple operation.

Apart from the obvious drawback ”namely, that you cannot install public assemblies into the GAC ”the other major problem with this approach is that many applications require some Windows integration features, such as Start menu icons or an Uninstall option available to the user . While you may be able to use batch files or other specialized scripts to overcome some of these limitations, a professional installation program will quickly demonstrate its superiority. Thus, while copying files can prove useful in some limited scenarios, this technique will rarely fulfill the needs of commercial applications.

Downloading Files to the Computer

This chapter has already discussed a few ways that applications can be completely or partially hosted on the Internet, and then downloaded as required.

The first scenario depicted an application being downloaded and executed by Internet Explorer. One option for this sort of deployment is to create a Web page that contains a link to the .NET-created executable, with users then being directed to that Web page. .NET will manage the download and security verification of the application and execute it (albeit possibly with reduced permissions, depending on the site configuration).

Another scenario discussed earlier in this chapter is to install the main application on the local machine, then reference other dependent assemblies via a codeBase element in a .NET configuration file. Referenced assemblies will be downloaded as necessary using the application configuration file to locate each assembly. This scenario works particularly well when the application always uses the same assemblies. For example, consider a word processor configuration that specifies a remote spell-checker assembly. This assembly would be downloaded only when the spell checker was actually started, rather than when the application starts.

Using this approach for deploying applications is associated with several drawbacks. One disadvantage is that the security settings for remote assemblies could restrict the functionality of the application. In general, .NET severely restricts access to assemblies downloaded from the Internet, so you might have to develop a custom security configuration for these assemblies.

Another problem with this approach is that the downloaded assemblies are typically stored in the download cache. Depending on the configuration and resources of the machine, the assembly may later be removed from the cache, and re-downloaded when the application is next run, making the application appear quite slow. Storing these assemblies as either private assemblies or public assemblies in the GAC prevents this problem.

Using Traditional Installation Programs

Traditional installation programs are used to install most complex or commercial applications, if for no better reason than "first impressions ": A single program can be executed to install your application, complete with wizards, flashy graphics, and a professional interface. More practical reasons for using installation programs include the ability to modify the Start menu, to provide Uninstall and Rollback capabilities, and to allow complete customization of the installation options.

For whatever reasons, most companies find themselves investigating dedicated installation packages for their applications. Companies such as InstallShield and Wise produce well-regarded offerings, and a number of highly capable, free installers have appeared recently. Most of these packages provide some kind of graphical user interface to define the installation options and any dialogs or wizard pages displayed by the installer. They generally combine the application files into a single, compressed executable file ready to be installed by users.

In an effort to increase the reliability of its operating system and better manage the installation of applications, and particularly any shared files installed by applications, Microsoft recently introduced the Microsoft Windows Installer. This operating system service manages the installation of applications, which is driven by an installer script that defines the installation properties and options. The Windows Installer manages all versioning and features such as Uninstall, Rollback, or Install on Demand, so that poorly written installation programs cannot destroy the system. It is built into all versions of Windows later than Windows 2000; it is available as a stand-alone component for Windows 95 and Windows 98.

The script used by the Windows Installer is fully documented and can be created in a number of ways. Most commercial vendors have released or are releasing versions of their installation programs that create Windows Installer packages rather than the stand-alone executable files they previously created. Such programs allow you to leverage these vendors ' user interfaces so as to quickly and simply build installations for your users.

Microsoft has released version 2.0 of the Windows Installer containing features specific to .NET, such as the ability to install public assemblies in the GAC. Most commercial installation programs have already released .NET-aware versions of their products, which you can use immediately to deploy your .NET applications.

Installing the .NET Framework

In many cases, for your applications to run correctly, you will need to ensure that the .NET Framework is correctly installed on your target PCs.Although .NET will ship with all future Microsoft operating systems, at time of writing no operating systems came with a default .NET installation.

To assist you with this dilemma, Microsoft provides a redistributable version of the .NET Framework, which currently weighs in at around 20MB (it can be downloaded from http://www.microsoft.com/net). The better installation programs will automatically manage the task of confirming the .NET Framework's presence. If your program does not, then you must make your own arrangements for ensuring that the .NET Framework is installed on each PC that needs to run your application.



Programming in the .NET Environment
Programming in the .NET Environment
ISBN: 0201770180
EAN: 2147483647
Year: 2002
Pages: 146

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