Evjen c34.tex V1 - 01/28/2008 4:20pm Page 1546 Chapter 34: Packaging and Deploying ASP.NET Applications Figure 34-15 This screen tells you what you are installing (the Default Web Site) as well as the name of the virtual directory created for the deployed Web application. The consumer can feel free to change the name of the virtual directory in the provided text box. A button in t his dialog allows for an estimation of the disk cost (space required) for the installed application. In .NET 3.5, the installer also allows the end user to choose the application pool he or she is interested in using for the application. The next series of screens install the WebSetup1 application (shown in Figure 34-17). After the application is installed, you can find the WebSetup1 folder and application files located in the C: \ Inetpub \ wwwroot folder (within IIS). The application can now be run on the server from this location. Uninstalling the Application To uninstall the application, the consumer has a couple of options. First, he can relaunch the .msi file and use the option to either repair the current installation or to remove the installation altogether (as shown in Figure 34-18). The other option is to pull up the Add/Remove Programs dialog from the server’s Control Panel. On the Control Panel, you see WebSetup1 listed (as shown in Figure 34-19). This dialog holds information about the size of the installed application and, if you are using Windows XP, it will also show you how often the application is used. Also, if you are using Windows XP, clicking 1546 Evjen c34.tex V1 - 01/28/2008 4:20pm Page 1547 Chapter 34: Packaging and Deploying ASP.NET Applications Figure 34-16 the support link pulls up the Support Info dialog, whichshowstheproject’spropertiesthatyouentered a little earlier (see Figure 34-20). However, if you are using Windows Vista, you can get at the same information by right-clicking on the column headers and selecting the More option from the provided menu. This gives you a list of options (shown here in Figure 34-21), providing the same information as what you can see in Windows XP. From the Add/Remove Programs dialog, you can remove the installation by clicking the Remove button of the selected program. Looking More Closely at Installer Options The Windows Installer service easily installs a simple ASP.NET Web application. The installer takes care of packaging the files into a nice .msi file from which it can then be distributed. Next, the .msi file takes care of creating a virtual directory and installing the application files. The installer also makes it just as easy to uninstall the application from the server. All these great services are provided with very little work on the user’s part. 1547 Evjen c34.tex V1 - 01/28/2008 4:20pm Page 1548 Chapter 34: Packaging and Deploying ASP.NET Applications Figure 34-17 Figure 34-18 1548 Evjen c34.tex V1 - 01/28/2008 4:20pm Page 1549 Chapter 34: Packaging and Deploying ASP.NET Applications Figure 34-19 Figure 34-20 Even though this approach addresses almost everything needed for an ASP.NET installer program, the setup and deployment project for Web applications provided by Visual Studio really provides much more in the way of options and customizations. This next section looks at the various ways you can work with modifying the installer program. 1549 Evjen c34.tex V1 - 01/28/2008 4:20pm Page 1550 Chapter 34: Packaging and Deploying ASP.NET Applications Figure 34-21 Working with the Deployment Project Properties You can work with the project properties of the installer from Visual Studio in several ways. The first way is by right-clicking the installer project from the Solution Explorer of Visual Studio and selecting Properties from the menu. This pulls up the WebSetup1 Properties Pages dialog shown in Figure 34-22. This dialog has some important settings for your installer application. Notice that, like other typical projects, this setup and deployment project allows for different active build configuration settings. For instance, you can have the active build configuration set to either Release or Debug. You can also click on the Configuration Manager button to get access to configuration settings for all the projects involved. In addition, this dialog enables you to add or remove build configurations from the project. The Output File Name The Output File Name setting lets you set the name of the .msi file that is generated. By default, it is the name of the project, but you can change this value to anything you want. This section also allows you t o modify the location where the built .msi is placed on the system after the build process occurs. 1550 Evjen c34.tex V1 - 01/28/2008 4:20pm Page 1551 Chapter 34: Packaging and Deploying ASP.NET Applications Figure 34-22 Package Files The Package files section of this properties page e nables you to specify how the application files are packaged in the .msi file. The available options include the following: ❑ As loose, uncompressed files: This option builds the project so that a resulting .msi file is created without the required application files. Instead, these application files are kept separate from the .msi file but copied to the same location as the .msi file. With this type of structure, you must distribute both the .msi file and the associated application files. ❑ In setup file: This option (which is the default option) packages the application files inside the .msi file. This makes distribution an easy task because only a single file is distributed. ❑ In cabinet file(s): This option packages all the application files into a number of cabinet files. T he size of the cabinet files can be controlled through this same dialog (discussed shortly). This is an ideal type of installation process to use if you have to spread the installation application over a number of DVDs, CDs, or floppy disks. Installation URL Invariably, the ASP.NET applications you build have some component dependencies. In most cases, your application depends on some version of the .NET Framework. The installation of these dependencies, or components, can be made part of the overall installation process. This process is also referred to as 1551 Evjen c34.tex V1 - 01/28/2008 4:20pm Page 1552 Chapter 34: Packaging and Deploying ASP.NET Applications bootstrapping. Clicking the Prerequisites button next to the Installation URL text box gives you a short list of available components that are built into Visual Studio in order to bootstrap to the installation program you are constructing (see Figure 34-23). Figure 34-23 As you can see from when you first enter this settings dialog, the .NET Framework 3.5 and the Windows Installer 3.1 options are enabled by default, and you check the other components (thereby enabling them) only if your Web application has some kind of dependency on them. From this dialog, you can also set how the dependent components are downloaded to the server where the installation is occurring. The options include downloading from Microsoft, from the server where the application originated, or from a defined location (URL) specified in the provided text box. Compression The Windows Installer service can work with the compression of the application files included in the build process so that they are optimized for either speed or size. You also have the option to turn off all compression optimizations. The default setting is Optimized for Speed. 1552 Evjen c34.tex V1 - 01/28/2008 4:20pm Page 1553 Chapter 34: Packaging and Deploying ASP.NET Applications CAB Size The CAB Size section of the properties page is enabled only if you select In Cabinet File(s) from the Package Files drop-down list, as explained earlier. If this is selected, it is enabled with the Unlimited radio button selected. As you can see from this section, the two settings are Unlimited and Custom : ❑ Unlimited : This selection means that only a single cabinet file is created. The size of this file is dependent on the size of the collection of application files in the Web application and the type of compression selected. ❑ Custom : This selection allows you t o break up the installation across multiple cabinet files. If the Custom radio button is selected, you can enter the maximum size of the cabinet files allowed in the provided text box. The measure of the number you place in the text box is in kilobytes (KB). Additional Properties You learned one place where you can apply settings to the installer program; however, at another place in Visual Studio you can find even more properties pertaining to the entire installer program. By selecting the WebSetup1 installer program in the Solution Explorer, you can work with the installer properties directly from the Properties window of Visual Studio. The following table lists the properties that appear in the Properties window. Property Description AddRemoveProgramsIcon Defines the location of the icon used in the Add/Remove Programs dialog found through the system’s Control Panel. Author The author of the installer. This could be the name of a company or individual. Description Allows for a textual description of the installer program. DetectNewerInstalledVersion Instructs the installer to make a check on the installation server if a newer version of the application is present. If one is present, the installation is aborted. The default setting is True (meaning that the check will be made). Keywords Defines the keywords used when a search is made for an installer. Localization Defines the locale for any string resources and the runtime user interface. An example setting is English (United States) . Manufacturer Defines the name of the company that built or provided the installer program. ManufacturerUrl Defines the URL of the company that built or provided the installer program. PostBuildEvent Specifies a command line executed after the build ends. PreBuildEvent Specifies a command line executed before the build begins. 1553 Evjen c34.tex V1 - 01/28/2008 4:20pm Page 1554 Chapter 34: Packaging and Deploying ASP.NET Applications Property Description ProductCode Defines a string value that is the unique identifier for the application. An example value is {885D2E86-6247-4624- 9DB1-50790E3856B4} . ProductName Defines the name of the program being installed. RemovePreviousVersions Specifies as a Boolean value whether any previous versions of the application should be uninstalled prior to installing the fresh version. The default setting is False . RestartWWWService Specifies as a Boolean value whether or not IIS should be stopped and restarted for the installation process. The default value is False . RunPostBuildEvent Defines when to run the post-build event. The default setting is On successful build . The other possible value is Always . SearchPath Defines the path to use to search for any files, assemblies, merge modules on the development machine. Subject Allows you to provide additional descriptions for the application. SupportPhone Specifies the support telephone number for the installed program. SupportUrl Specifies the URL by which the end user can get support for the installed a pplication. TargetPlatform Defines the target platform of the installer. Possible values include x86 , x64 ,and Itanium . Title Defines the title of the installer program. UpgradeCode Defines a shared identifier that can be used from build to build. An example value is {A71833C7-3B76-4083-9D34- F074A4FFF544} . Version Specifies the version number of the installer, cabinet file, or merge module. An example value is 1.0.1 . The following sections look at the various editors provided to help you build and customize the construc- tion of the installer. You can get at these editors by clicking the appropriate icon in the Solution Explorer in Visual Studio or by choosing View ➪ Editor in the Visual Studio menu. These editors are explained next. The File System Editor The first editor that comes up when you create your installer program is the File System Editor. The File System Editor enables you to add folders and files that are to be installed on the destination server. In addition to installing folders and files, it also facilitates the creation of shortcuts. This editor is shown in Figure 34-24. 1554 Evjen c34.tex V1 - 01/28/2008 4:20pm Page 1555 Chapter 34: Packaging and Deploying ASP.NET Applications Figure 34-24 The File System Editor has two sections. The left section is the list of folders to be installed during the installation process. By default, only the Web Application Folder is shown. Highlighting this folder, or one of the other folders, gives you a list of properties for that folder in the Properties window of Visual Studio. The following table details some of the properties you might find in the Properties window. Property Description AllowDirectoryBrowsing Allows browsing of the selected directory in IIS. The default value is False . AllowReadAccess Specifies whether the selected folder should have Read access. The default value is True . AllowScriptSourceAccess Specifies the script source access of the selected folder. The default value is False . AllowWriteAccess Specifies whether the selected folder should have Write access. The default value is False . ApplicationProtection Defines the IIS Application Protection property for the selected folder. Possible values include vsdapLow , vsdapMedium ,and vsdapHigh . The default value is vsdapMedium . AppMappings Enables you to define the IIS application mappings for the selected folder. DefaultDocument Defines the default document of the selected folder. The default value is Default.aspx . ExecutePermissions Defines the IIS Execute Permissions property. Possible values include vsdepNone , vsdepScriptsOnly , vsdepScriptsAnd- Executables . The default value is vsdepScriptsOnly . Index Specifies the IIS Index of this resource property for the selected folder. The default value is True . IsApplication Specifies whether an IIS application root is created for the installed application. The default value is True . 1555 . are using Windows XP, clicking 154 6 Evjen c34.tex V1 - 01/28/2008 4:20pm Page 154 7 Chapter 34 : Packaging and Deploying ASP. NET Applications Figure 34 -16 the support link pulls up the Support Info. user’s part. 154 7 Evjen c34.tex V1 - 01/28/2008 4:20pm Page 154 8 Chapter 34 : Packaging and Deploying ASP. NET Applications Figure 34 -17 Figure 34 -18 154 8 Evjen c34.tex V1 - 01/28/2008 4:20pm Page 154 9 Chapter. referred to as 155 1 Evjen c34.tex V1 - 01/28/2008 4:20pm Page 155 2 Chapter 34 : Packaging and Deploying ASP. NET Applications bootstrapping. Clicking the Prerequisites button next to the Installation