20.6 Setting Launch Conditions on the Installation

 <  Day Day Up  >  

You want to impose launch conditions on the installation; for example, you want to only install the application if some prerequisites are already installed.


Technique

You can set launch conditions ”conditions that must be satisfied or the setup program aborts the entire install ”using the Launch Conditions Editor (see Figure 20.12), which you can find under View, Editor.

Figure 20.12. The Launch Conditions Editor.

graphics/20fig12.gif

VS.NET automatically adds the condition that the .NET Framework must be installed when it creates the project, and you can add further conditions.

Right-clicking on the Search Target Machine node allows you to add a search of the target computer. You can specify files, Registry keys, or names of applications installed by Windows Installer that must be present on the target machine before the setup program proceeds.

Right-clicking on the Launch Conditions node allows you to add launch conditions that are based on information known to Windows Installer. You can set the details of the conditions by setting values in the Properties Window for each condition. Figure 20.13 shows a launch condition that only allows setup to proceed if the computer is running Windows 2000 or later.

Figure 20.13. Restricting installations to machines running Windows 2000 or later.

graphics/20fig13.gif

The Message property is the error message that gets displayed if the launch condition fails. The Condition itself comes from a list of properties that are not part of .NET but are defined within the Windows Installer itself. VersionNT is a Windows Installer property that has the value 400 on machines running NT4, 500 for Windows 2000, and so on. This property is not available on machines running Windows 9x (which means that any test for this property having any value will fail). The full list of available Windows Installer properties is too long to present here; however, you can find the list at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/versionnt_property.asp. Note that as new versions of Windows Installer are released, the list of properties is likely to grow further. Table 20.1 presents a few of the more significant properties.

Table 20.1. Some Useful Windows Installer Properties

Property

Values

VersionNT

400 =NT4, 500 =W2K, 501 =WXP, 502 =W2K3 Server

Version9x

400 =Win95, 410 =Win98, 490 =Win ME

ServicePackLevel

Number of any installed Windows Service Pack; it has the value 5 if you are running NT4 SP5.

ScreenX

Width of screen in pixels.

ScreenY

Height of screen in pixels.

PhysicalMemory

Size of installed RAM in MB.

 <  Day Day Up  >  


Microsoft Visual C# .Net 2003
Microsoft Visual C *. NET 2003 development skills Daquan
ISBN: 7508427505
EAN: 2147483647
Year: 2003
Pages: 440

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