Вы находитесь на странице: 1из 24

Module 8

Deploying Components
and Class Libraries
Module Overview
Introduction to Components and Class Libraries

Deploying a Component/Class Library

Best Practices for Deploying a Component/Class Library


Lesson 1: Introduction to Components and Class
Libraries
Factors for Creating Deployable Units of Software

Software Development Life Cycle

Upgrading and Maintenance Within the Software


Development Life Cycle
Identifying Components and Classes in a Business
Scenario
Factors for Creating Deployable Units of Software

Factors include:

Deployment models
Performance impact and constraints
Security boundaries
Tight/loose coupling
Reusability
Future business requirements
Software Development Life Cycle

Building

Envisioning Deploying
Planning Stabilizing
Upgrading and Maintenance Within the Software
Development Lifecycle

After deployment:

Classes will be updated


Class libraries may be shared
Side-by-side execution simplifies maintenance
Discussion: Identifying Components and Class
Libraries in a Business Scenario
Blue Yonder Airlines Flight Tracker

Crew

Ground Air

Aircraft Flight Ticket Passenger

Inter-
Domestic Frequent
national
Flyer
Lesson 2: Deploying a Component/Class Library
Preparing an Application to Use Component/Class
Libraries
What Is an Assembly?
Demonstration: Creating and Referencing a Class Library
from an Application
Deploying an Assembly
What Is the Global Assembly Cache?
Installing an Assembly into the Global Assembly Cache
Demonstration: Installing an Assembly into the Global
Assembly Cache
Managing Versioning Within an Application Using a
Component/Class Library
Demonstration: Updating and Deploying a Class
Library/Component
Preparing an Application to Use Component/Class
Libraries

Refactoring code into class libraries:

1. Create the class library


2. Move code from the application to the class library
3. Build the class library into an assembly
4. Add a reference to the assembly in your project
5. Import the Namespace for your class library
What Is an Assembly?

Assemblies:

Are a collection of types and resources


Form a deployable unit
Are a building block of a .NET application

Contents of assemblies:

Intermediate language code


Resources
Type metadata
Demonstration: Creating and Referencing a Class
Library from an Application
In this demonstration, you will:
Prepare an application to use a class library

Create a class library

Build a class library

Reference the class library from the application

Import the namespace of the class library

Build and test the application


Deploying an Assembly

There are two ways to deploy an assembly containing


a class library:

Deploying to the directory of the application using the


assembly
Deploying to the Global Assembly Cache
What Is the Global Assembly Cache?

Stores assemblies that are shared between multiple


applications

Benefits:
Side-by-side deployment and execution
Improved loading and search time
Reduced memory consumption
Installing an Assembly into the Global Assembly
Cache

There are four ways to install an assembly into


the cache:

Global Assembly Cache Tool (gacutil.exe)


Windows Installer
Assembly Cache Viewer (Shfusion.dll)
.NET Framework Configuration Tool (Mscorcfg.msc)
Demonstration: Installing an Assembly into the
Global Assembly Cache
In this demonstration you will learn:
How to deploy an assembly to the global assembly cache

Assign a strong name to an assembly

Create a setup project for the assembly


Manage Versioning Within an Application Using a
Component/Class Library

Versioning:
Assembly manifest stores the version number
Assembly version number is a four-part string
<major version>.<minor version>.<build
number>.<revision>

Redirecting binding requests:


Create a publisher policy file
Use the <bindingRedirect> element
Demonstration: Updating and Deploying a Class
Library/Component
In this demonstration you will:
Modify a class in the class library

Build a new version of the assembly for the class library

Deploy the version of the assembly

Direct the application to use the new version of the


assembly
Test the application
Lesson 3: Best Practices for Deploying a
Component/Class Library
Best Practices: Deploying Components/Class Libraries

Verifying Results
Best Practices: Deploying Components/Class
Libraries

Deployment Best Practices:

Consider reusability for components/class libraries


Establish a deployment strategy
Record software dependencies
Consider a service-oriented architecture

Maximizing Code Reuse:


Establish standard contracts/interfaces
Consider adding functionality to increase future
usability
Consider alternative versioning methods
Verifying Results

To verify results:

Establish common scenarios for maintenance and upgrades

Walk through the planned deployment strategy

Ask the questions:


Does the change impact other components/class libraries?
Are any contracts/interfaces affected?

Test a change scenario

Look for the following:


Changes that cross software boundaries
Changes that affect communication layers such as
contracts/interfaces
Lab: Deploying Components/Class Libraries
Exercise 1: Creating a Component/Class Library

Exercise 2: Deploying the Application

Exercise 3: Updating the Component/Class Library

Exercise 4: Configuring a Specific Assembly

Logon information

Virtual machine 6367A-LON-SVR1


User name Administrator
Password Pa$$w0rd
Estimated time: 40 minutes
Lab Review
Why is it important to ensure that the structure of the
application in terms of components is decided early?
What was necessary to do to the assemblies before
building the setup package for deployment.
What can be used to redirect the binding of an assembly?
Module Review and Takeaways
Review Questions

Common Issues and Troubleshooting Tips

Real-world Issues and Scenarios

Best Practices

Tools
Course Evaluation

Вам также может понравиться