You are on page 1of 26

Packaging and Deploying .

NET Applications

Pre-Assessment Questions
1. User defined exceptions are derived from the __________ class.
a. System.Exception
b. System.ApplicationException
c. System.SystemException
d. System.CustomException

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 1 of 26


Packaging and Deploying .NET Applications

Pre-Assessment Questions (Contd.)


2. Which of the following involves end user participation?
a. Unit Testing.
b. Acceptance Testing.
c. Regression Testing.
d. Integration Testing.

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 2 of 26


Packaging and Deploying .NET Applications

Pre-Assessment Questions (Contd.)


3. Which of the following is not true about test cases?
a. Test cases should test every line of code.
b. Test cases should include data values outside the range of valid data
values.
c. Test cases should include all possible allowed data values.
d. Test cases should include invalid data values.

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 3 of 26


Packaging and Deploying .NET Applications

Pre-Assessment Questions (Contd.)


4. Which of the following is used to locate and fix known bugs in a program?
a. Tracing
b. Testing
c. Exception Handling
d. Debugging

5. The On Error GoTo 0 statement is used to:


a. Disable any exception handlers
b. Pass the control to the first line of code
c. Pass the control to the last line of code
d. Pass the control to the next line of code

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 4 of 26


Packaging and Deploying .NET Applications

Solutions to Pre-Assessment
Questions
1. b.
2. b.
3. c.
4. d.
5. a.

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 5 of 26


Packaging and Deploying .NET Applications

Objectives
In this lesson, you will learn to:
• Create assemblies and place them in the Global Assembly Cache
• Identify the version information stored in an assembly
• Implement different deployment strategies
• Identify different types of deployment projects
• Create a deployment project
• Use various editors in a deployment project
• Deploy an application

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 6 of 26


Packaging and Deploying .NET Applications

Working with Assemblies


• An assembly is the collection of all information required by the Common
Language Runtime (CLR) to execute an application.

• An assembly is self-descriptive and consists of three things:


• Manifest
• Microsoft Intermediate Language Code( MSIL)
• Required Resources

• There are two types of assemblies:


• Single-File
• Multi-Fie

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 7 of 26


Packaging and Deploying .NET Applications

Working with Assemblies (Contd.)

• An assembly that groups all elements in a single file is called a single-file


assembly

• An assembly that groups its elements in multiple files is called a multi-file


assembly.

• Assemblies can also be classified as:


• Private assemblies
• Shared assemblies

• For assemblies to be shared they must be added to the Global Assembly Cache
(GAC).

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 8 of 26


Packaging and Deploying .NET Applications

Working with Assemblies (Contd.)


• Sharing an assembly and installing it to the GAC requires your assembly to be
signed with a strong name.

• A strong name uniquely identifies an assembly.

• To create a strong named assembly, you need to:


• Create a strong named key pair using sn.exe utility:
sn –k myKey.snk

• In the AssemblyInfo file, add attributes that describe the assembly:


<Assembly: AssemblyKeyFile (“myKey.snk”)>
<Assembly: AssemblyVersion (“1.0.1.2”)>

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 9 of 26


Packaging and Deploying .NET Applications

Working with Assemblies (Contd.)

• An assembly can be added to the GAC by using the following methods:


• Using the Windows installer
• Using the Gacutil.exe that is the Global Assembly Cache tool.
• Using the Windows drag and drop feature.

• The version number of the assembly is divided into four parts. They are:
• Major version number
• Minor version number
• Build number
• Revision number

• The ILDisassembler utility can be used to view information about an assembly.


ildasm <assembly name>
©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 10 of 26
Packaging and Deploying .NET Applications

Getting Started with Deploying .NET


Applications
• The different deployment strategies are:

• XCOPY Deployment
• Visual Studio .NET Deployment Tools

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 11 of 26


Packaging and Deploying .NET Applications

XCOPY Deployment
• XCOPY deployment uses the MS-DOS XCOPY command to copy the contents of
a directory and subdirectories to a target computer

• Limitations of XCOPY Deployment:

• Requires that all files needed by the application are located in the
application directory.
• Requires that the .NET Framework be installed on the target machines.
• For applications that requires databases and shared components, the
required resources must be available on each client machine.

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 12 of 26


Packaging and Deploying .NET Applications

Visual Studio .NET Deployment Tools


• Visual Studio .NET Deployment Tools allow you to create setup programs for
deploying applications.

• To create a setup program for an application, Visual Studio.NET provides a


special project type called Setup and Deployment Projects.

• The Setup and Deployment Projects type provides various templates for
deploying different types of applications:

• Setup Project
• Web Setup Project
• Merge Module Project
• Cab Project

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 13 of 26


Packaging and Deploying .NET Applications

Visual Studio .NET Deployment Tools


(Contd.)
• In addition to the templates, Visual Studio .NET provides Setup Wizard that
simplifies the task of creating a deployment project.

• You use the Setup Project template to package all application files and create
a Windows Installer (.msi) file.

• A Web Setup project is similar to a Setup project but is used to install a


Web-based application on a Web server.

• A Merge Module Project template should be used to deploy a component


that is shared by a number of applications.

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 14 of 26


Packaging and Deploying .NET Applications

Visual Studio .NET Deployment Tools


 

(Contd.)
• When you build a merge module project, a .msm file is created. The .msm file
cannot be executed independently and must be merged with another
deployment project that creates a .msi file.

• You use the Cab Project template to package components that can be
downloaded from a Web server to a Web browser

• The Setup Wizard guides you through a number of steps for creating a basic
deployment project.

• You can use deployment project editors to specify details like files to be
included and registry entries to be made at the time of installation.

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 15 of 26


Packaging and Deploying .NET Applications

Deployment Project Editors


• Visual Studio.NET provides the following six editors in deployment projects:

• File System
• Registry
• File Types
• User Interface
• Custom Actions
• Launch Conditions

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 16 of 26


Packaging and Deploying .NET Applications

Deployment Project Editors (Contd.)


• The File System editor allows you to perform the following functions:

• Add a special folder


• Adding a custom folder
• Add a subfolder
• Delete a folder
• Add and remove project outputs
• Add and remove files
• Add and remove shortcuts

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 17 of 26


Packaging and Deploying .NET Applications

Deployment Project Editors (Contd.)


• The Registry editor allows you to perform the following functions:
• Add and remove registry keys
• Add and remove registry key values
• Importing an existing registry file in the registry editor

• The File Types editor allows you to perform the following functions:
• Add and remove file types
• Add and remove actions

• The User Interface editor allows you to perform the following functions:
• Add and remove dialog boxes
• Customize installation dialog boxes

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 18 of 26


Packaging and Deploying .NET Applications

Deployment Project Editors (Contd.)


• The Custom Actions editor allows you to add and remove custom actions.

• The Launch Conditions editor allows you to perform the following


functions:

• Add a file launch condition


• Add a registry launch condition
• Add a windows installer launch condition
• Add the .NET Framework launch condition
• Add the Internet Information Services launch condition

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 19 of 26


Packaging and Deploying .NET Applications

Deployment Via Distributable Media


and Networks
• For deployment via distributable media, the .msi files created using Visual
Studio .NET deployment tools can be copied to a floppy disk or other media.

• To deploy to a network location:


• Create a Web Setup project.
• Use the File System Editor to add the project output group for the
application to the Web Setup project.
• After building the installer, copy it to the server computer, from
where it can be downloaded over the network.

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 20 of 26


Packaging and Deploying .NET Applications

Practice
Deploying a Windows Based
Application

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 21 of 26


Packaging and Deploying .NET Applications

Problem Statement
• The development of the application for a stockbroker’s office 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 to start 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.

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 22 of 26


Packaging and Deploying .NET Applications

Solution
To solve the preceding problem, the following steps need to be performed:

1. Create a Deployment Project


2. Add the application files to the deployment project
3. Create a shortcut of the application
4. Add a dialog box to the deployment project
5. Build the solution and execute the installer

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 23 of 26


Packaging and Deploying .NET Applications

Summary
In this lesson, you learned that:

• An assembly is a collection of all information required by the Common


Language Runtime (CLR) to execute your application.
• Deployment is the process of distributing the files that constitute an
application.
• An assembly that groups all files in a single file is called a single-file
assembly.
• An assembly made up of multiple files is called a multi-file assembly.
• Assemblies can be private or shared.
• For sharing an assembly it needs to be installed in the Global Assembly
Cache.
• After creating an assembly for a component, you can create a deployment
project to deploy the component.

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 24 of 26


Packaging and Deploying .NET Applications

Summary (Contd.)
In this lesson, you learned that:

• There are two common deployment strategies available with .NET. They are:
• XCOPY Deployment
• Setup and Deployment projects

• To help you create a setup program for your application, Visual Studio.NET
provides a special project type called Setup and Deployment Projects.

• The Setup and Deployment Project type provides a number of templates for
deploying different types of applications. These are:
• Setup Project
• Merge Module Project
• Web Setup Project
©NIIT • Cab Project
Enhancing and Distributing Applications Lesson 2A / Slide 25 of 26
Packaging and Deploying .NET Applications

Summary (Contd.)
In this lesson, you learned that:
• Visual Studio .NET provides the following six editors in deployment projects:
• File System
• Registry
• File Types
• User Interface
• Custom Actions
• Launch Conditions

©NIIT Enhancing and Distributing Applications Lesson 2A / Slide 26 of 26

You might also like