Tài liệu Module 4: Deployment and Versioning doc

48 468 0
Tài liệu Module 4: Deployment and Versioning doc

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

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 Module 4: Deployment and Versioning 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 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. Presentation: 90 Minutes Lab: 50 Minutes 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 ! 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. 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. 2 Module 4: Deployment and Versioning " "" " Introduction to Application Deployment ! 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. 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. Module 4: Deployment and Versioning 3 Common Concepts ! 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 ****************************** 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. 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. 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. 4 Module 4: Deployment and Versioning Simple Applications ! 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. 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. Module 4: Deployment and Versioning 5 Componentized 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. Topic Objective To describe how assemblies are handled in componentized applications. Lead-in Componentized applications are only slightly more complex than applications. 6 Module 4: Deployment and Versioning Configuration and 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. 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. [...]... Packaging and Deployment Tools in this module 22 Module 4: Deployment and Versioning A Versioned Assembly Topic Objective To discuss the physical representation and logical mapping of the compatibility version number ! Applications Need to Bind to a Suitable Version of a Shared Assembly Lead-in ! The Version Number Is Represented by a 4-Part Number The final packaging and deployment example in this module. .. 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 32 Module 4: Deployment and Versioning Related Topics Topic Objective To briefly introduce several related topics and provide references for students to follow up on Lead-in This module introduces the concepts of packaging and deployment. .. assembly cache, as shown in the following example: gacutil /u AReverser Module 4: Deployment and Versioning 31 " Related Topics and Tools Topic Objective To introduce the topics in the section Lead-in This section briefly introduces additional topics that are related to deployment and versioning ! Related Topics ! Packaging and Deployment Tools *****************************ILLEGAL FOR NON-TRAINER USE******************************... publickey property and a non-default version, which is specified by the ver property of 1:0:0:0 The following example shows the disassembled code: assembly AReverser { publickey = (00 71 8A 7D 6A D7 ) hash algorithm 0x00008004 ver 1:0:0:0 } module AReverser.dll For more information about the Strong Name tool, see Packaging and Deployment Tools in this module 20 Module 4: Deployment and Versioning Deploying... libraries and does not itself produce a library Module 4: Deployment and Versioning Using Microsoft Intermediate Language Disassembler to Examine Hello World Compiling this small application generates the HelloDemoCS.exe Important To use Microsoft Visual Studio® NET tools within a command prompt window, the command prompt window must have the proper environment settings The Visual Studio NET Command Prompt... Dump command on the File menu 9 10 Module 4: Deployment and Versioning To see additional information about the application, double-click Manifest The following window appears The preceding illustration shows the manifest, which contains information about the assembly, including the version (not yet set), external libraries, and types within those libraries, which the application uses Deployment Deployment... applications to applications that make use of assembly versioning *****************************ILLEGAL FOR NON-TRAINER USE****************************** The examples in this section show how to deploy a simple application, an application that uses a shared assembly, and an application that makes use of assembly versioning 8 Module 4: Deployment and Versioning A Simple Application Topic Objective To explain... 0:0:0:0 } module AReverser.dll Module 4: Deployment and Versioning 19 Generating a Public-Private Key Pair To create an assembly with a strong name, you must compile the assembly by using a private key Public keys are used for verification Therefore, before compiling the assembly, you must first generate a public-private key pair You use the Strong Name tool (Sn.exe) to generate a new key pair and place... will not break another program, and no other application can cause HelloDemoCS.exe to stop functioning Module 4: Deployment and Versioning 11 A Componentized Application Topic Objective To introduce compapp, a componentized application, which uses multiple assemblies Lead-in The Hello World application that is discussed in the preceding topic is completely trivial and hardly representative of even... you can then examine the system assembly cache by typing: gacutil /l Module 4: Deployment and Versioning 21 The output of this command is: AReverser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=! 0588613cb04b772e, Custom=null You can also examine the system assembly cache by navigating to the \WindowsDirectory\Assembly directory and by using the cache shell extension Uninstalling a Strong-Named . Application Deployment 2 Application Deployment Scenarios 7 Related Topics and Tools 31 Lab 4: Packaging and Deployment 37 Review 42 Module 4: Deployment and Versioning. many new concepts of the .NET Framework, including deployment and versioning. Module 4: Deployment and Versioning 9 Using Microsoft Intermediate Language

Ngày đăng: 10/12/2013, 16:15

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan