vb .net tutorial - 16
TRANSCRIPT
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 1 of 28
Objectives
In this lesson, you will learn to:
Identify different types of deployment projects
Create a deployment project
Use editors in a deployment project
Deploy an application
Deploy a component
Deploy a Web service
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 2 of 28
Visual Studio .NET Deployment
Is a process of distributing the files that make up an application to install it on target computers.
Involves the task of packaging all files and components and creating a setup program that
Copies all the necessary files to the target computer.
Stores files in appropriate folders.
Creates the necessary registry entries.
Creates a Start menu item and an icon on the desktop of a user computer to provide easy access to the application.
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 3 of 28
Setup and Deployment Projects
Provide a number of templates for deploying different types of applications depending on the type of application that
needs to be deployed and the mode of deployment. They are:
Setup Project
Merge Module Project
Web Setup Project
Cab Project
Setup Wizard
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 4 of 28
Setup Project Template
Is used to package all application files and create a Windows Installer (.msi) file.
Web Setup Project Template
Is used to install a Web-based application.
Is similar to a setup project.
Merge Module Project Template
Is used to create a single package that contains all files, resources, registry entries, and the setup logic necessary for deploying a component.
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 5 of 28
Is similar to a dynamic link library (DLL), which allows applications to share code with a difference that it allows various Windows Installers to share the installation code.
Resolves any version-related problems by identifying all the dependencies for a component and ensuring that the
correct versions of the components are installed.
Cab Project Template
Is used to package components that can be downloaded from a Web server to a Web browser.
Is typically used when you want a component to execute on a client computer instead of a Web server.
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 6 of 28
Deployment Project Editors
Can be used to specify the files that needs to be included in the project and the registry entries to be made for the
application that has to be deployed.
Can also be used to customize the user interface.
Are of the following types:
File System
Registry
File Types
User Interface
Custom Actions
Launch Conditions
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 7 of 28
The File System Editor
Is displayed by default.
Displays a standard set of folders that represent the folder structure on the target computer.
Contains the navigation pane and the details pane. The navigation pane displays a list of folders. When you select a
folder, the files and shortcuts in the folder are displayed in the details pane.
Can be used to add subfolders, special folders, or custom folders to a deployment project. Special folders represent some predefined Windows folders.
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 8 of 28
The File System Editor (Contd.)
Allows adding project outputs (such as .exe and .dll files) and additional files (such as readme.txt) to a
deployment project.
Allows specifying the folders on the target computers to which the application files are to be copied.
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 9 of 28
The Registry EditorProvides a hierarchical representation of the registry on the
target computer.
Has a layout similar to that of the Windows Registry editor.
Is used to add registry keys and values to the registry on the target computer.
Contains two panes, the navigation pane and the detail pane. The navigation pane displays a standard set of registry keys that correspond to the registry keys on the target computer. They are:
HKEY_CLASSES_ROOT
HKEY_USERS
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 10 of 28
The File Types Editor
Allows you to specify file types and file associations on a target computer.
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 11 of 28
The User Interface Editor
Displays the dialog boxes that are automatically added by Visual Studio.NET when you create a deployment project.
Is used to provide customized dialog boxes.
Contains a list of dialog boxes, which are divided into two sections:
Install
Administrative Install
Categorizes dialog boxes as follows:
Start dialog boxes
Progress dialog boxes
End dialog boxes
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 12 of 28
The Custom Actions Editor
Is used to add custom actions to a deployment project. These actions must be compiled into a .dll or an .exe file and added to the deployment project by using the File System editor.
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 13 of 28
The Launch Conditions Editor
Is used to ensure that the version of the operating system on the target computer is appropriate for running your application or search the target computer for a
particular file or a key in the registry.
Can be used to add a number of launch conditions. These conditions are:
File launch condition
Registry launch condition
Windows Installer launch condition
.NET Framework launch condition
Internet Information Services launch condition
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 14 of 28
Just a Minute…
Which of the following deployment editors can be used to specify Control Panel settings on the target computer?
a) File Systems editor
b) Launch Conditions editor
c) Registry editor
d) User Interface editor
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 15 of 28
Problem Statement 16.D.1
The development of the Call Center module for Diaz Telecommunications is complete. The application now needs to be shipped to the client so that it can be installed on user computers. The installation process should perform the following tasks:
Copy all application files to a user computer.
Create a shortcut on the desktop of a computer for starting the application.
When a user begins installation, a license agreement should be displayed to the user. The process of installation should proceed only when a user accepts the license agreement.
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 16 of 28
Task List
Identify the type of deployment project to be used for creating the installer.
Identify the editors to be used in the deployment project.
Create a deployment project.
Add the application files to the deployment project.
Create a shortcut for the application.
Add a dialog box to the deployment project.
Build the solution.
Execute the installer.
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 17 of 28
Task 1: Identify the type of deployment project to be used for creating the installer.
Result:
In the given scenario, a Windows-based application is to be installed. For this, you can use the Setup and Deployment Projects project type and the Setup Project template.
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 18 of 28
Task 2: Identify the editors to be used in the deployment project.
Result:
The following table lists the tasks to be performed by the installation package and the editor that can be used to perform the task:
Task Editor
Copy all files to the target computer File System editor
Create a shortcut for the application on the desktop of a computer
File System editor
Create a shortcut for the application on the Programs menu
File System editor
Display a license agreement to a user User Interface editor
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 19 of 28
Task 3: Create a deployment project.
Task 4: Add the application files to the deployment project.
Task 5: Create a shortcut for the application.
Task 6: Add a dialog box to the deployment project.
Task 7: Build the solution.
Task 8: Execute the installer.
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 20 of 28
Deploying Components
COM components suffer from various problems relating to deployment such as:
Registration
Versioning
The .NET platform solves the issues relating to the deployment of components by using assemblies. An assembly has the following features:
Is self-describing.
Records version information and enforces it at run time.
Provides the ability to work with side-by-side components.
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 21 of 28
Deploying Components
The process of deploying components involves the following steps:
Creating an assembly
Single-file Assembly
Multi-file Assembly
Deploying an assembly
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 22 of 28
Just a Minute…
Consider the following files:
CalcDisc.VB
ProductDet.VB
List the steps that you will follow to create a single deployable unit containing these two files.
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 23 of 28
Deploying Web Services
Is done simply by copying the .asmx file corresponding to the Web service and the assemblies used by the Web
service to the destination computer that has Internet Information Services (IIS) 4.0 or later installed on it.
Can also be done by using a Web Setup deployment project.
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 24 of 28
Summary
In this lesson, you learned that:
Deployment is the process of distributing the files that constitute an application.
To help you create a setup program for your application, Visual Studio .NET provides a special project type called Setup and Deployment Projects. This project type provides
a number of templates for deploying different types of applications.
Visual Studio .NET provides four templates for deployment projects. These are:
Setup Project: Allows you to package all application files and create a Windows Installer (.msi) file.
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 25 of 28
Summary (Contd.)
Merge Module Project: Allows you to create a single package that contains all files, resources, registry entries, and the setup logic necessary for deploying a component.
Web Setup Project: Allows you to package all files of a Web application or a Web service.
Cab Project: Allows you to package components that can be downloaded from a Web Server to a Web browser.
Visual Studio .NET provides the following six editors in deployment projects:
File System: Allows you to add special folders, custom folders, subfolders, and files to a deployment project.
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 26 of 28
Summary (Contd.)
Registry: Allows you to add registry keys and values to a deployment project.
File Types: Allows you to specify file associations in a deployment project.
User Interface: Allows you to add and remove dialog boxes from a deployment project.
Custom Actions: Allows you to add custom actions to the deployment project.
Launch Conditions: Allows you to specify launch conditions in a deployment project.
To solve the problems of registration and version pertaining to the deployment of COM components, Microsoft has introduced assemblies in its .NET platform.
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 27 of 28
Summary (Contd.)
An assembly has the following features:
It is self-describing.
It records version information and enforces it at run time.
It provides the ability to work with side-by-side components.
An assembly may be embedded within a single DLL file. Such an assembly is called a single-file assembly.
You can create a single-file assembly by using Visual Studio .NET or the vbc compiler.
Deploying .NET Applications
©NIIT Deploying .NET Applications/Lesson 16/Slide 28 of 28
Summary (Contd.)
An assembly made up of multiple files is called a multi-file assembly. In case of a multi-file assembly, at least one
of the files in the assembly must contain the assembly manifest.
You can create a multi-file assembly by using the Al.exe utility.
After creating an assembly for a component, you can create a deployment project to deploy the component.
You can deploy a Web service simply by copying the .asmx file corresponding to the Web service and the
assemblies used by the Web service to the destination computer.
You can also use a Web Setup deployment project to deploy a Web service.