Title: Deploying a Desktop Application
1Chapter 21
- Deploying a Desktop Application
2Key Deployment Terms (1)
- The process of distributing an application is
called deployment - Deploy an application by creating another type of
projected called an installer - The installer produces a Setup.exe file that is
run by the user - The Setup.exe file relies on other support files
containing the actual program to install
3Key Deployment Terms (2)
- The players
- The development computer is the computer where
the Deployment project is built - The target computer is the end users computer
where the Deployment project will be run
4Steps in the Deployment Process
- Configure a Windows Application project for
release distribution - Create a Deployment project within an existing
solution - Set global properties for the Deployment project
- Configure the Deployment project using the visual
editors - Compile the Deployment project and test the
installer - Distribute the installer
5Configuring a Project for Deployment
- Visual Studio .NET supports two default
configurations - Debug configuration is used for debugging
- Program Debug Database (.pdb) file is created for
debugging - Program is not optimized
- Release configuration is used for distribution
- DEBUG constant is not defined
- Debug information is not generated
- Program is optimized for performance
- Custom configurations are also possible
6Configuring an Application
- The Configuration Manager lists all of the
projects in a solution and is used to configure
them - Configuration column is used to specify the
desired configuration - Check the item in the Build column to build the
project
7Configuration Manager (Illustration)
8Types of Deployment Projects
- Setup Project creates an installer for removable
media - CD or DVD for example
- Web Setup Project builds an installer for
Web-based deployment - Merge Module Projects are used to deploy Class
Library projects - Cab Project used to create cabinet files
- Cabinet files are similar to Zip files
- They are not used much anymore
9Add New Project Dialog box
Setup project
10Multi-project Solutions
- Until now, a solution has had a single project
- Here we work with a Setup project and Windows
application project in the same solution
11Multi-project Solutions (Illustration)
- The Solution Explorer displays all projects
12Characteristics of Deployment Projects
- Deployment projects do not contain namespace
references - Deployment projects do not contain forms
- Deployment projects do not contain code
- Deployment projects are created and configured
using different visual editors - It's just about all WYSIWYG
13Properties of a Deployment Project
- Many properties are set using the Projects
Property pages. Others are set using the
Properties window - Output file name contains the name of the
installer - Package files list box defines how files will be
deployed - Compression list box defines whether the
installer is optimized for speed or size
14Deployment Project (Property Pages)
15General Deployment Project Properties (1)
- Author and Manufacturer properties contain a
company name - Description contains a free form description
- DetectNewerInstalledVersion, if True causes the
installer to prompt the user if a newer version
is already installed - Localization creates custom installers for
different languages - ManufacturerUrl property contains the companys
URI
16General Deployment Project Properties (2)
- ProductName appears as the component description
in the Add/Remove programs dialog box - RemovePreviousVersions property controls whether
older versions will be removed - Version contains the version number of the
installer - This is the version of the installer itself
rather than the version of the deployed project
17General Deployment Properties (Illustration)
18Configuring a Deployment Project (Introduction)
- Six Deployment Project Editors configure a
Deployment project - In general, you need not write any code
19Deployment Editors
- File System Editor defines which files are
installed on the target computer - File Types Editor associates files extensions
with an application - User Interface Editor configures the dialog boxes
the user sees when they run the installer - Launch Conditions Editor specifies target system
requirements - Custom Actions Editor allows custom dialogs to be
created - Registry Editor allows the installer to read and
write Registry values
20The File System Editor (Purpose)
- It is used to define the layout file system
layout on the target computer - Application Folder represents the files copied to
the target computer - Define the items that will appear on the Start
menu - Users Programs Menu folder
- Add items to the target computers desktop
- Users Desktop folder
21The File System Editor (Illustration)
22Adding Items to the Target File System
- The Application folder contains four types of
project items - Folders represent folders that will be created on
the target computer - Project Outputs represents the distributable
executable application(s) that will be copied to
folders - Files are just other files to be deployed with
the application - Data files, tutorial files, etc.
- Assembly items is used to specify additional
assembles needed by the application
23Adding a Project Output
- Five primary types of project outputs
- Primary output the .exe and .dll files produced
a result of compiling a project - It is possible to deploy multiple primary outputs
- Localized resources Satellite assemblies for
localized resource files - Debug Symbols Deploys the debugging information
- Content Files Help files, data files, tutorial
files, etc. - Source Files Deploys the source code for the
application - We won't discuss documentation files and XML
Serialization Assemblies
24Add Project Output Group Dialog Box
25Configuring the Start Menu and Desktop
- Add items to the Users Programs Menu folder in
the File System Editor to configure the Start
menu - It is possible to create sub folders and deploy
items to those sub folders - Add items to the Users Desktop folder to add
outputs to the users desktop
26Deploying Support Files
- Using the File System Editor, create folders and
sub folders - Add files to those sub folders
27Creating File Associations
- File associations bind file extensions to
applications - Double-click a file in Windows Explorer and the
application loads - An application may have multiple file
associations - Two or more file extensions may be associated
with the same application - Use care not to overwrite existing file
associations (.doc, .xls, etc.)
28Creating File Associations (Steps)
- Use the File Types Editor to associate a file
type with an executable file - Optionally, associate the file type with an icon
- Icon appears in Windows Explorer
- Modify the application, as necessary, to read to
read and process the file when the application
starts
29The File Types Editor
- Use to create file associations
- A File Type (extension) has the following
properties - Command property specifies the executable file
that will be launched when the action is invoked - Description property value appears in Windows
Explorer - Extensions property contains the file extension
- Separate multiple file extensions with a
semicolon () - Icon property contains the associated icon
30File Types Editor
31Reading Command Line Arguments (1)
- The Microsoft.VisualBasic.Command function gets
command line arguments - Arguments are returned as a string
- Remove the quotation marks surrounding the
string, if necessary - pstrCommandArgs Microsoft.VisualBasic.Command()
- pstrCommandArgs pstrCommandArgs.Remove(0, 1)
- pstrCommandArgs pstrCommandArgs.Remove( _
- pstrCommandArgs.Length 1, 1)
32Reading Command Line Arguments (2)
- In C, we read command line arguments
- http//msdn.microsoft.com/en-us/library/cb20e19t(v
VS.80).aspx
33Custom Installer Dialog Boxes
- An installer consists of multiple dialog boxes
filled out by the user - The User Interface Editor is used to configure
the dialog boxes when the user runs the installer - Add existing predefined dialog boxes to the
installer - Configure the order in which those dialog boxes
appear
34Default Dialog boxes
- By default, the User Interface Editor includes
five dialog boxes - Welcome dialog box displays a welcome message
- Installation Folder lets the user select the
installation folder - Confirm Installation is the final chance to
continue or abort the installation - Progress dialog box displays the relative
completion - Finished dialog box indicates that the
installation is complete
35Custom Dialog Boxes (1)
- Three RadioButtons dialog boxes
- One contains 2 buttons, another 3, and another 4
- Three CheckBoxes dialog boxes display between 1
and 4 check boxes - Customer Information gets customer name and
organization - Three TextBoxes dialog boxes display between 1
and 4 text boxes - License Agreement dialog box displays a license
agreement
36Custom Dialog Boxes (2)
- Read Me dialog box displays a multiline text box
containing an informational message - Register dialog box allows the user to register
online - Splash dialog box displays an introductory splash
screen
37The User Interface Editor
38Adding a Dialog
39License Agreement Dialog Box
- License agreement is an RTF file
- RTF file containing the license file must be
added to the Deployment project - In the Properties window for the License
agreement, select the project item containing the
license file
40Checkboxes Dialog Box
- BannerBitmap contains the image appearing in the
banner section - BannerText contains the text appearing in the
banner area - CheckBox1Value indicates whether the checkbox is
checked or not - CheckBox1Visible indicates whether the check box
is visible - CheckBox1Property contains the name to be tested
in a condition - Additional properties of the same name but
different number are used to set the remaining
three check boxes
41Conditional Deployment (Introduction)
- There are two ways to conditionally deploy files
- In the Properties window of the File System
Editor, deployable elements have a property named
Condition - Use it to build a condition. If the condition is
true, the file or other element will be deployed
to the target computer. If the condition is
False, the file will not be deployed - Launch conditions provide the means to test for
the existence of a file for the installation to
succeed - Test for Internet Explorer or a particular
operating system version, for example
42Creating a Launch Condition
- Launch Conditions test the following types of
conditions before deployment can succeed - Test whether a file or program exists and
optionally, the version of that program - Test the version of the operating system
- Test whether the .NET Framework is installed
- Test the amount of physical memory installed on
the computer
43Launch Condition Properties
- MsiNetAssemblySupport Used to determine if .NET
is installed on the target computer - Version9X Used to determine if the OS version
on the target is Windows 95, 98 or Windows ME - VersionNT Used to determine if the OS version
on the target is Windows NT, Windows 2000 or
Windows XP - PhysicalMemory returns the amount of physical
memory installed in the target computer
44Launch Condition Editor
45File Launch Conditions
- FileName contains the name of a file that must be
installed on the target computer - MinDate and MaxDate control the minimum and
maximum file dates - Folder property controls where the installer
searches for file names - Depth project controls number of directory levels
to search - MinVersion and MaxVersion controls minimum and
maximum version number for files
46Compiling the Installer
- Compile the same way as any project would be
compiled - Output files differ however
- .msi file contains the deployment files
- InstMsiA.exe and InstMsiW.exe read and process
the .msi file - Setup.Exe program runs the installer
- Setup.Ini file is read by the Setup.Exe program
47Testing the Installer
- There are Two ways to test the installer
- From inside of Visual Studio .NET
- Use to install or uninstall the software
- Run Setup.Exe directly
- The project will be installed just as the user
will see it