Deploying a VB 'NET Application - PowerPoint PPT Presentation

1 / 52
About This Presentation
Title:

Deploying a VB 'NET Application

Description:

Multiple folders and sub folders can be added ... Radiobutton dialogs will work too. There are two ways to perform a conditional deployment ... – PowerPoint PPT presentation

Number of Views:362
Avg rating:3.0/5.0
Slides: 53
Provided by: michaelv50
Category:

less

Transcript and Presenter's Notes

Title: Deploying a VB 'NET Application


1
Chapter 14
  • Deploying a VB .NET Application

2
Objectives
  • Understand deployment with Visual Studio .NET
  • Create a setup project with a wizard
  • Learn how to deploy to different media
  • Add a Deployment project to a solution
  • Deploy support files with an application
  • Add file associations
  • Create Custom Installer dialog boxes
  • Install the .NET Framework

3
Computers used in the Deployment Process
  • Two computers are used in the deployment process
  • The development computer is where you create the
    deployment project and build a program called an
    installer
  • The user then runs the installer on the target
    computer
  • In this chapter, your computer will fulfill both
    roles
  • The deployment process is essential because a
    .NET program cannot run without the .NET
    Framework installed

4
Steps to Deploy a Project
  • Open an existing solution containing one or more
    projects
  • Create a Deployment project within the solution
  • Here you can see one purpose of the solution file
  • Configure the Deployment project
  • Specify the files that you want to deploy
  • Specify the items that you want added to the
    Start menu on the target computer
  • Build the Deployment project thus creating the
    Setup.exe file and related files
  • Distribute the Setup.exe file and related files

5
Creating a Setup Project with a Wizard
  • The Setup Project Wizard contains 5 dialog boxes
  • The first is a Welcome dialog box
  • In the second dialog box, you specify the type of
    project to deploy
  • In the third dialog box, you specify the program
    outputs
  • In the fourth dialog box, you select any
    additional support files
  • The final dialog box displays a summary report

6
Specifying a Deployment Configuration (1)
  • VB .NET supplies two default configurations for
    compiling an application
  • The Debug configuration allows a project to be
    debugged from within Visual Studio .NET
  • The Release configuration removes debugging code
  • Use the project's Property Pages to select the
    configuration

7
Specifying a Deployment Configuration (2)
Active configuration
8
Adding a Deployment Project
Select Setup and Deployment Projects
Setup Wizard selected
9
Choosing a Project Type
Create a Deployment project for a Windows
application
10
The Difference Between Debug and Release
Configurations
  • The Debug configuration builds a project such
    that the debugging tools can be used to examine
    the values of variables and perform other
    debugging tasks
  • In the Release configuration, the debugging
    information is stripped out
  • Use the Configuration Manager to select the
    current configuration
  • Right-click the project in the Solution Explorer,
    and then select Configuration Manager

11
The Configuration Manager
Release version
Check to build projects
12
Deploying to Different Media (1)
  • Projects can be deployed to different types of
    media
  • Floppy disks
  • CD-ROM
  • The Internet
  • Use the Property Pages for the Setup Project to
    select the media type

13
Deploying to Different Media (2)
Possible Package options
14
Types of Deployment Projects
  • Merge Module projects are used to deploy a Class
    Library
  • A Setup Project is used to deploy a typical
    Windows Application Project
  • A Web Setup Project builds an installer for an
    ASP.NET application
  • A Cab Project is used to add a cabinet file for
    older Web browsers that cannot install software
    directly

15
Deployment Project Properties
  • Set using the Properties window just as you would
    with any other property
  • Author and Manufacturer properties contain the
    name of the company that developed the
    application
  • Description property contains a textual
    description
  • DetectNewerInstalledVersion property will prompt
    the user if a newer version of the application is
    already installed
  • RemovePreviousVersions property allows the
    installer to remove old software versions
  • Version property assigns a version number to the
    installer. This is the version of the installer
    not the application

16
Deployment Project Editors (Introduction)
  • Use the Deployment Project Editors to manually
    configure the Deployment project
  • File System Editor is used to define which files
    will be deployed and where on the target computer
    those files will be deployed
  • The Registry Editor allows you to define an
    installer that will add or update entries to the
    Registry on the target computer
  • The File Types Editor creates file associations
  • The User Interface Editor allows you to add
    custom dialog boxes to the installer
  • The Custom Actions Editor allows you to further
    customize the installation process
  • The Launch Conditions Editor will check that
    specific components are installed on the target
    computer

17
The Role of the File System Editor
  • The File System Editor provides three services
  • You specify the files that you want to deploy to
    the target computer
  • Files may include executable files and any
    additional support files
  • You specify any items that will be added to the
    Start menu on the target computer
  • You specify any shortcuts that will be added to
    the desktop on the target computer

18
File System Editor (Illustration)
19
File System Editor (Folders)
  • Three Folders appear in the File System Editor
  • The Application Folder controls the destination
    folder where files will be stored
  • User's Desktop defines any desktop icons that
    will appear on the target computer
  • User's Programs Menu is used to define any items
    that will appear on the Start menu
  • Note that new folders can be added to the Start
    menu too

20
Defining the Files for Deployment
  • Adding a Folder causes the installer to create a
    new folder on the target computer
  • Multiple folders and sub folders can be added
  • You typically add executable files or other
    support files to these folders
  • Every solution produces one or more outputs
    (executable files)
  • Select Project Output to add an executable file
  • The File section allows you to select additional
    files
  • The Assembly option allows you to add additional
    assemblies

21
Adding a Project Output
Select project
Select output
Select the Release configuration
22
Deployment Project (Files)
  • You build the Deployment project just as you must
    build any other project. The build produces the
    following files
  • Setup1.msi contains the installer
  • InstMsiA.Exe and InstMsiW.exe are support files
    used in conjunction with Setup1.msi
  • InstMsiA.Exe is the ASCII version
  • InstMsiW.Exe is the Unicode (wide) version
  • The user runs the file Setup.Exe
  • Setup.ini contains initialization information

23
Testing the Installer
  • You can test the installer by
  • Running the Setup.Exe program from Windows
    Explorer
  • Right clicking the Deployment project in the
    Solution Explorer, and then clicking Install
  • This will deploy the project as if it were being
    deployed on the target computer

24
Deploying Support Files
  • You may want to deploy support files in addition
    to any executable files
  • Support files may be deployed to any folder that
    you specify
  • Support files may include
  • Database files
  • Text files
  • Help files
  • Other data files

25
Adding Folders to a Target
  • If deploying a large number of files, organizing
    those files into different folders will reduce
    clutter
  • In the File System Editor, add folders to the
    Application Folder
  • Note that folders may also have sub folders
  • Then add files to those newly created folders

26
Adding Folders to a Target (Illustration)
Sub folders
27
Adding Data Files to a Target
  • Use the File System Editor again
  • Steps to add a data file
  • Select the desired folder in the File System
    Editor
  • Right-click the folder
  • Click Add, and then click File from the popup
    menu
  • Select the desired file from the dialog box

28
Adding File Associations
  • File associations allow the user to double-click
    a file to run the associated application
  • Use the File Types Editor to add a file
    association
  • Multiple file extensions may be associated with
    the same project
  • Be careful not to use well-known well-defined
    file associations such as .doc, .xls, or .mdb

29
File Associations (Properties)
  • The Command property specifies the executable
    file that will be launched
  • The Description property contents appears in the
    File Types column of Windows Explorer
  • Using the Extensions property you define the file
    extensions
  • Multiple files extensions are separated by a
    semicolon
  • The Icon property defines the icon that will
    appear in Windows Explorer

30
Creating a File Association (Steps)
  • Activate the File Types Editor for the Deployment
    project
  • Right-click File Types on Target Machine, and
    then click Add File
  • Rename the File type
  • Set the Command property using the Properties
    window
  • Set the Description property using the properties
    window
  • Set the Extensions property to the desired file
    extension or file extensions
  • Separate multiple files extensions with a
    semicolon

31
File Types Editor (Illustration)
32
The Command Function
  • Use the Command function to get command line
    arguments
  • The command function belongs to the
    Microsoft.VisualBasic namespace
  • When the user double-clicks a file, the file is
    passed as a command line argument
  • Command line arguments are stored in a string
  • Call the Split method of the System.String class
    to break up the string if necessary

33
The Command Function (Example)
  • Call the command function storing the arguments
    in the variable named pstrCommandArgs

Dim pstrCommandArgs As String pstrCommandArgs
Microsoft.VisualBasic.Command()
34
Default Installer Dialog Boxes
  • When the user runs the installer the following
    dialog boxes appear by default
  • Welcome dialog box displays a welcome message
  • Installation Folder allows the user to override
    the default installation folder
  • Confirm Installation dialog box allows the user
    to confirm or abort the installation
  • Progress dialog box displays the relative
    progress of the installation
  • Finished dialog box displays an installation
    summary
  • You can customize the installer by adding
    additional dialog boxes

35
Custom Installer Dialog Boxes (Introduction)
  • RadioButtons Dialog box containing two or more
    radio buttons
  • Checkboxes Dialog box containing one or more
    check boxes
  • Customer Information Used to supply a customer
    name and organization
  • Textboxes contains one or more text boxes
  • License Agreement Requires that the user accept
    a license agreement
  • Read Me An introductory read me dialog box
  • Register Forces the user to register your
    software
  • Splash Screen An introductory screen

36
Adding a Custom Dialog Box (Steps)
  • Activate the User Interface Editor
  • On the VB .NET menu bar, click Action, and then
    click Add Dialog to activate the Add Dialog box
  • Select the dialog that you want to add
  • Move the dialog box to the desired position
  • Typically a splash screen appears first

37
Add Dialog Box (Illustration)
38
User Interface Editor (Illustration)
Installation dialogs
39
Introduction to Conditional Deployment
  • You can configure the installer so that the user
    can elect to deploy or not deploy specific files
  • Use a Checkboxes dialog so that the user can make
    the selection
  • Radiobutton dialogs will work too
  • There are two ways to perform a conditional
    deployment
  • Use the Condition property
  • Build a launch condition

40
Creating a Checkboxes Dialog
  • A Checkboxes dialog contains one or more check
    boxes
  • Create by adding a custom dialog just as you
    added a splash screen
  • Configure the dialog using the Properties window

41
Custom Checkboxes Dialog (Properties)
  • BannerBitmap property defines the picture that
    appears in the banner area
  • BannerText property defines any text that appears
    in the banner area
  • For the following properties, n indicates which
    check box. Value ranges between 1 and 4 (4
    checkboxes)
  • CheckBoxnLabel defines the text that appears
  • CheckBoxnProperty works like the Name property of
    a control instance
  • CheckBoxnValue property defines whether the check
    box is checked or not
  • CheckBoxnVisible controls whether the check box
    is visible or not

42
Using the Condition Property
  • Use the File System Editor to define the
    condition for a file, executable, or Start menu
    item
  • Steps
  • In the File System Editor, select the desired
    file, and then activate the Properties window
  • Set the Condition property using the name of the
    Check box
  • For example
  • CHKTUTORIALS1

43
Launch Conditions
  • Launch conditions allow you to require that a
    particular piece of software is already installed
    or that the software version is at some minimum
    level
  • For example
  • The Version9X property is used to determine
    whether Windows 95, Windows 98 or Windows ME is
    running
  • VersionNT is used for Windows NT, Windows 2000,
    or Windows XP
  • The PhysicalMemory property returns the amount of
    ram on the target computer

44
Operating System Version Numbers
  • Version9X
  • 400 for Windows 95
  • 410 for Windows 98
  • 490 for Windows ME
  • VersionNT
  • 400 for Windows NT
  • 500 for Windows 2000
  • 501 for Windows XP

45
Creating a Launch Condition (Steps)
  • Activate the Launch Conditions Editor
  • Using the popup menu, add a launch condition
  • Set the Name and Message properties as desired
  • Set the Condition property to set for Windows
    2000 or Windows XP as in
  • VersionNT501 OR VersionNT500

46
Launch Condition Editor (Illustration)
47
Launch Condition Properties
  • FileName contains the name of the file for which
    you are searching
  • For example Internet Explorer is IExplore.exe
  • MaxDate and MinDate contains maximum and minimum
    file dates respectively
  • Folder property contains folder where the
    installer will search for the FileName
  • Depth property contains number of sub directories
    that will be searched
  • MinVersion and MaxVersion properties contain
    minimum and maximum version numbers

48
Defining a Launch Condition (Steps)
  • Activate the Launch Condition Editor
  • Right-click Requirements on Target Machine and
    then click Add File Launch Condition
  • Set the Name property to a descriptive name
  • Set the Filename property to the desired file
  • Set the Folder property to ProgramFilesFolder,
    and then set the Condition property

49
Installing the .NET Framework (Introduction)
  • To run any .NET application, the .NET Framework
    must be installed
  • The file name is DotNetfx.exe
  • File size is about 20 megabytes
  • Run the executable file as you would run any
    installer
  • This file can be downloaded from Microsoft and
    installed by the user
  • This is not the best alternative as many users
    will not know what the .NET Framework is

50
Installing the .NET Framework from a Deployment
project
  • Create an installer called a bootstrapper
  • The bootstrapper installs the .NET Framework and
    then runs your installer
  • Download a version of the bootstrapper from
    Microsoft
  • Note that the bootstrapper must be configured

51
Configuring the Bootstrapper
  • Edit the settings.ini file and set the MSI key to
    the name of your installer
  • Msi.\DataFileSetup.msi
  • Set the FsInstallerPath key to the name of the
    Framework file (DotNetfx.exe)
  • FsInstallerPath.\dotnetfx.exe

52
Data Access Requirements
  • Applications that access data require that the
    Microsoft Data Access Components version 2.6 or
    later are installed
Write a Comment
User Comments (0)
About PowerShow.com