Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

C# ПІДРУЧНИКИ / c# / MS Press - Msdn Training Programming Net Framework With C#

.pdf
Скачиваний:
173
Добавлен:
12.02.2016
Размер:
16.87 Mб
Скачать

Module 4: Deployment

and Versioning

Contents

 

Overview

1

Introduction to Application Deployment

2

Application Deployment Scenarios

7

Related Topics and Tools

31

Lab 4: Packaging and Deployment

37

Review

42

Information in this document, including URL and other Internet Web site references, is subject to change without notice. Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses, logos, people, places and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, e-mail address, logo, person, place or event is intended or should be inferred. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation.

Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.

2001-2002 Microsoft Corporation. All rights reserved.

Microsoft, ActiveX, BizTalk, IntelliMirror, Jscript, MSDN, MS-DOS, MSN, PowerPoint, Visual Basic, Visual C++, Visual C#, Visual Studio, Win32, Windows, Windows Media, and

Window NT are either registered trademarks or trademarks of Microsoft Corporation in the U.S.A. and/or other countries.

The names of actual companies and products mentioned herein may be the trademarks of their respective owners.

Module 4: Deployment and Versioning

iii

 

 

 

Instructor Notes

Presentation:

90 Minutes

Lab:

50 Minutes

After completing this module, students will be able to:

!Package and deploy simple and componentized applications.

!Create strong-named assemblies.

!Install and remove assemblies from the global assembly cache.

!Configure an application to control its binding to an assembly based on the assembly’s location and version data.

Materials and Preparation

This section provides the materials and preparation tasks that you need to teach this module.

Required Materials

To teach this module, you need the Microsoft® PowerPoint® file 2349B_04.ppt.

Preparation Tasks

To prepare for this module, you should:

!Read all of the materials for this module.

!Complete the lab.

iv

Module 4: Deployment and Versioning

Module Strategy

Use the following strategy to present this module:

!Introduction to Application Deployment

Introduce common concepts, such as the Microsoft .NET Framework hierarchy of namespaces, the organization of assemblies, and the role of the assembly manifest. Describe simple and componentized applications, and their configuration and distribution scenarios.

!Application Deployment Scenarios

The examples in this section show how to deploy a simple stand-alone application, an application that uses a shared assembly, and an application that makes use of assembly versioning.

Introduce compapp, a componentized application, which uses multiple assemblies. Contrast compapp with the simple single assembly Hello World application that was created in Module 2, “Introduction to a Managed Execution Environment,” in Course 2349B, Programming with the Microsoft .NET Framework (Microsoft Visual C#.NET).

!Related Topics and Tools

Briefly introduce additional topics that are related to deployment and versioning but are beyond the scope of this course. This section also provides a list of tools that you can use to work with assemblies.

You should just inform the students of these topics and encourage them to look for more information in the .NET Framework Software Development Kit (SDK) documentation. In addition, Course 2350A, Securing and Deploying Microsoft .NET Assemblies (Prerelease), covers code access security and role-based security in greater detail.

Module 4: Deployment and Versioning

1

 

 

 

Overview

Topic Objective

To provide an overview of the module topics and objectives.

Lead-in

In this module, you will learn about packaging and deployment of Microsoft

.NET Framework applications and assemblies.

!Introduction to Application Deployment

!Application Deployment Scenarios

!Related Topics and Tools

*****************************ILLEGAL FOR NON-TRAINER USE******************************

This module introduces the concepts of packaging and deployment of Microsoft® .NET Framework applications and assemblies. The .NET Framework provides improved isolation of application assemblies, simplified application deployment, and robust versioning.

This module walks you through the packaging and deployment of a simple Hello World application, and a small, componentized application. These applications are written in C#, the new language designed for the .NET Framework. The steps that are necessary to construct, compile, and run C# applications were explained in Module 2, “Introduction to a Managed Execution Environment,” and Module 3, “Working with Components,” both in Course 2349B, Programming with the Microsoft .NET Framework (Microsoft Visual C#.NET).

Because this course is an introduction to programming in the .NET Framework, you should spend some time reading the .NET Framework Software Development Kit (SDK) documentation. In fact, the labs, demonstrations, and material for this module and other modules in this course are based on several tutorials in the .NET Framework SDK.

After completing this module, you will be able to:

!Package and deploy simple and componentized applications.

!Create strong-named assemblies.

!Install and remove assemblies from the global assembly cache.

!Configure an application to control its binding to an assembly based on the assembly’s location and version data.

2Module 4: Deployment and Versioning

" Introduction to Application Deployment

Topic Objective

To introduce issues that arise in application deployment and to introduce the topics in the section.

Lead-in

You can deploy a .NET Framework application in several ways.

!Common Concepts

!Simple Applications

!Componentized Applications

!Configuration and Distribution

*****************************ILLEGAL FOR NON-TRAINER USE******************************

You can deploy a .NET Framework application in several ways depending on the following considerations:

!The complexity of the application

!The sharing of assemblies with other applications

!The application’s security and protection requirements

!The application’s method of distribution

An application’s deployment is not affected by the .NET Framework common language runtime-compatible language that is used to develop the application. All applications that are written for use with the .NET Framework are compiled to the same self-describing, Microsoft intermediate language (MSIL) code and run with he same .NET Framework runtime.

This section introduces common concepts, such as the .NET Framework hierarchy of namespaces, the organization of assemblies, and the role of the assembly manifest. It then describes simple and componentized applications, and their configuration and distribution.

Module 4: Deployment and Versioning

3

 

 

 

Common Concepts

Topic Objective

To review the organization of the .NET Framework class library and assemblies, and the role of the assembly manifest.

Lead-in

The .NET Framework provides a common class library that is organized into a hierarchical tree of namespaces.

!Classes and Types Used in .NET Framework Applications Are:

#Organized in a hierarchy of namespaces

#Stored in PE files, such as DLLs and EXEs

#Fully described by metadata

!Assemblies:

#Are made up of one or more PE files

#Contain a manifest that identifies the assembly and its files

#Specify exported and imported classes and types

#Are units of deployment, reuse, and versioning

*****************************ILLEGAL FOR NON-TRAINER USE******************************

For Your Information

This topic reviews information that was covered in Module 2. Do not spend much time on this topic. Present the material as the starting point for a discussion of deployment and versioning.

As you learned in Module 2, “Introduction to a Managed Execution Environment,” in Course 2349B, Programming with the Microsoft .NET Framework (Microsoft Visual C# .NET), in addition to the common language runtime, the .NET Framework provides a common class library that is organized into a hierarchical tree of namespaces.

At the root of this hierarchy is the System namespace, which contains objects for many other useful classes that can be used from any .NET-compatible language. These objects include objects that are used for file I/O, messaging, networking, and security.

The Organization of PE Files into Assemblies

The .NET Framework class library that you and others create are also organized into hierarchical namespaces and stored in portable executable (PE) files, most typically DLLs and EXEs. A single PE file can contain several namespaces, including nested namespaces. You also can split a namespace across multiple PE files. One or more PE files, and possibly non-PE files, such as resources, are combined to create an assembly, which is a physical unit that can be deployed, versioned, and reused.

The Role of the Assembly Manifest

In the .NET Framework, each class type is fully described through the type’s metadata. Each assembly contains a manifest that includes the name of each type that is exported from the assembly, along with information about the file that contains that type’s metadata. The manifest also includes information about the identity of the assembly, such as name, files that make up the assembly, and version information, and full information about any dependencies on other assemblies.

The .NET Framework runtime uses assembly manifests to locate and bind to the referenced types.

4Module 4: Deployment and Versioning

Simple Applications

Topic Objective

To describe how easily an application can be executed in the .NET Framework.

Lead-in

In the simplest case, a .NET Framework application can be executed locally on any computer on which the .NET runtime is already installed.

!Require .NET Runtime Be Installed on Local Computer

!Can Be Run Directly from a File Server or Copied Locally

!Make No Registry Entries

!Cannot Break Another Application

#Eliminate DLL Hell

!Can Be Uninstalled by Deleting Locally Copied File(s)

*****************************ILLEGAL FOR NON-TRAINER USE******************************

In the simplest case, a .NET Framework application can be executed locally on any computer on which the .NET runtime is already installed. The program can run directly from a file server, or the files can be copied locally. Nothing else is required. No registry entries are made, and no other applications are broken or caused to stop running as a result.

The fact that no registry entries are made eliminates DLL versioning issues, commonly referred to as “DLL hell.” Just deleting the executable file, if it was copied locally, is sufficient to remove the application and leave no trace on the computer.

Module 4: Deployment and Versioning

5

 

 

 

Componentized Applications

Topic Objective

To describe how assemblies are handled in componentized applications.

Lead-in

Componentized applications are only slightly more complex than applications.

!Assemblies Private to an Application

#Same as a simple application

!Assemblies Private to Related Applications

#Deployed into a common subdirectory

!Assemblies Shared with Other Unrelated Applications

#Require a strong name and version information

#Deployed into the global assembly cache

*****************************ILLEGAL FOR NON-TRAINER USE******************************

Componentized applications are only slightly more complex than simple applications. The complexity of componentized applications depends on whether their components are:

!Contained in assemblies that are private to the application.

!Shared with other related applications.

!Shared with other potentially unknown applications.

If all of the component assemblies are private, the componentized application can be treated in the same manner as the application. The application can run from a file server, or the application files can be copied to a local volume.

Deleting all of a componentized application’s files is sufficient to remove the program.

Likewise, if several related applications use the same component assemblies, those assemblies can be located in a common subdirectory. However, if the application uses assemblies that are shared with other unrelated applications, these assemblies can be installed in the global assembly cache and have certain properties, such as a unique strong name that includes version information, that enable the .NET runtime to ensure that the application binds to the appropriate versions.

6Module 4: Deployment and Versioning

Configuration and Distribution

Topic Objective

To introduce options for configuring and deploying applications in the .NET Framework.

Lead-in

As a developer of .NET Framework applications, you should be aware of the different ways in which applications may be configured and packaged for distribution.

!Configuration

#Maintained in plain-text files

!Deployment

#Common distribution formats, such as a .CAB file or a .MSI file

#Common distribution mechanisms, such as Windows 2000 IntelliMirror or Microsoft Systems Management Server

*****************************ILLEGAL FOR NON-TRAINER USE******************************

As a developer of .NET Framework applications, you should be aware of the different ways in which applications may be configured and packaged for distribution. Usually, individual organizations, or an administrator within an organization, decide how an application is packaged for distribution and configured for the organization.

Configuration

In the .NET Framework, you can maintain application configuration in plain text files. This use of plain text XML-based application configuration files allows administrators to tailor an application’s behavior on a particular computer without having to involve developers in the process.

The following section, Application Deployment Scenarios, presents several common application scenarios. While this module does not cover ASP.NET deployment, most of the concepts that are presented in this module apply to ASP.NET deployment.

Deployment

Many client applications may be further packaged in a common distribution format, such as a .CAB file or .MSI file. Client applications may also be installed by using application distribution mechanisms, such as Microsoft Windows® 2000 IntelliMirror® or Microsoft Systems Management Server (SMS), which both use the Microsoft Windows Installer technology.

The Microsoft Windows Installer is an installation and configuration service that is included in the Windows 2000 operating system. It is provided in a service pack to Microsoft Windows 95, Microsoft Windows 98, and Microsoft Windows NT® version 4.0.

For more information about the Microsoft Windows Installer, see the Platform

SDK documentation.

Соседние файлы в папке c#