Top Banner
Slide 1 of 24 Session 14 Ver. 1.0 GUI Applications Development Using .NET Framework In this session, you will learn to: Implement various deployment strategies Use various editors in a deployment project Implement ClickOnce Configure a Windows application Secure Windows applications Objectives
24
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 10 gui 14

Slide 1 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET Framework

In this session, you will learn to:Implement various deployment strategies

Use various editors in a deployment project

Implement ClickOnce

Configure a Windows application

Secure Windows applications

Objectives

Page 2: 10 gui 14

Slide 2 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET Framework

Deployment is the process of distributing the files that make up an application to install it on the target computers.

There are two deployment strategies that can be used to deploy applications. The strategies are:

XCOPY Deployment

Visual Studio .NET deployment tools

Deploying .NET Applications

Page 3: 10 gui 14

Slide 3 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET Framework

The XCOPY command is used to copy the contents of a directory and its subdirectories to a target computer, where target computer is the computer on which you want to run the application.

The syntax of the XCOPY command is:

XCOPY <source path> <target path> /s

The limitations of XCOPY deployment are:It requires all files such as compiled .exe files, .dll files representing components or controls, and resource files.

It also requires the installation of the .NET Framework on the target machines.

It cannot be used for an application that requires databases and shared components. It is essential that these databases and shared components are installed on every client machine on which the program will be installed.

XCOPY Deployment

The /s switch indicates that all subdirectories are to be copied as well.

Page 4: 10 gui 14

Slide 4 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET Framework

Using this method, you can package all the files and components that make up the application and create a setup program.

This setup program can be used to perform the following tasks:

Copy all the necessary files to the target computer

Store files in appropriate folders

Create the necessary registry entries

Create a Start menu item

Create an icon on the desktop to access the application

Let us see how an application can be packaged and deployed in .NET.

Visual Studio .NET Deployment Tools

Page 5: 10 gui 14

Slide 5 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET Framework

To create a setup program for an application, Visual Studio .NET provides a special project type called Setup and Deployment Project.

This project type provides various templates for deploying various types of applications. These templates are:

Setup Project

Web Setup Project

Merge Module Project

Cab Project

Setup Wizard Project

Smart Device Cab Project

Visual Studio .NET Deployment Tools (Contd.)

Page 6: 10 gui 14

Slide 6 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET FrameworkJust a minute

What is the extension of the Windows Installer file?

Answer:.msi

Page 7: 10 gui 14

Slide 7 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET Framework

Deployment project editors help to customize various things. Two of them are:

Specifying files and folders to be included in the deployment project.

Creating registry entries when the application is deployed.

To perform these tasks, Visual Studio .NET provides the following editors in deployment projects:

File System Editor

Registry Editor

File Types Editor

User Interface Editor

Custom Actions Editor

Launch Conditions Editor

Using Deployment Project Editors

Page 8: 10 gui 14

Slide 8 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET FrameworkDemo: Deploying and Installing a Project

Problem Statement:The development of the EmployeeReport application is complete. The application now needs to be shipped to the client so that it can be installed on a user computer. 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.

Help the programmer to create the installer for the application.

Page 9: 10 gui 14

Slide 9 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET FrameworkDemo: Deploying and Installing a Project (Contd.)

Solution:To solve the preceding problem, you need to perform the following taks:

1. Create a deployment project.

2. Add the application files to the deployment project.

3. Create a shortcut of the application.

4. Add a license agreement to the deployment project.

5. Build the solution and execute the installer.

Page 10: 10 gui 14

Slide 10 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET Framework

ClickOnce is a new application deployment technology provided by Microsoft Visual Studio 2005.

A ClickOnce application provides automatic updates and installation from:

a Web page,

network file share, or

a CD-ROM

It allows you to create applications that provide easy installation and good user interfaces.

For creating the ClickOnce application, you can use the Publish Wizard in Visual Studio 2005 to package the application and publish it to a Web site or network file share.

Implementing ClickOnce

Page 11: 10 gui 14

Slide 11 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET Framework

To deploy an application using ClickOnce, you need to perform the following steps:1. Open Visual Studio 2005 and open the project.

2. Build the project and ensure that there are no compilation errors.

3. Execute the application and ensure that it meets required specification.

Deploying an Application Using ClickOnce

Page 12: 10 gui 14

Slide 12 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET FrameworkDemo: Publishing a ClickOnce Application

Problem Statement:Package and deploy the EmployeeReport application at the local machine using ClickOnce.

Help the student to develop the required application.

Page 13: 10 gui 14

Slide 13 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET FrameworkDemo: Publishing a ClickOnce Application (Contd.)

Solution:To meet the preceding requirement, you need to perform the following tasks:

1. Open the EmployeeReport project.

2. Prepare the application for deployment.

3. Publish the application.

Page 14: 10 gui 14

Slide 14 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET FrameworkDemo: Publishing a ClickOnce Application at the Web Server

Problem Statement:Package and deploy the EmployeeReport application at Web server using ClickOnce.

Page 15: 10 gui 14

Slide 15 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET FrameworkDemo: Publishing a ClickOnce Application at the Web Server (Contd.)

Solution:To meet the preceding requirement, you need to perform the following tasks:

1. Open the EmployeeReport project.

2. Prepare the application for deployment.

3. Publish the application.

Page 16: 10 gui 14

Slide 16 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET Framework

Configuration files are generally Extensible Markup Language (XML) files that contain configuration options, such as:

starting options

maximum resource usage options for applications

These files are used to:change application settings without recompiling the applications.

set machine policies, which affect the way applications run on a computer.

These files can be modified whenever required.

Configuration files are case sensitive.

Configuration Files

Page 17: 10 gui 14

Slide 17 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET Framework

There are three types of configuration files. These are:Application configuration files

Machine configuration files

Security configuration files

Types of Configuration Files

Page 18: 10 gui 14

Slide 18 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET FrameworkJust a minute

Identify the root element in every configuration file that is used by the CLR and .NET Framework applications.1. <runtime>

2. <config>

3. <configuration>

4. <assemblybinding>

Answer:3. <configuration>

Page 19: 10 gui 14

Slide 19 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET Framework

The .NET Framework allows developers and administrators to control the way applications run by changing the application settings in the application configuration file.

Configuring Applications

Page 20: 10 gui 14

Slide 20 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET Framework

The security of any computer can be maintained by authenticating a user.

Similarly, applications also need to be secured from unauthorized access or virus-attack.

There are several mechanisms to secure an application in the .NET environment.

The mechanisms for protecting resources and code from unauthorized code and users include:

Code access security: Controls the resources that your code can access.

Role-based security: Allows developers to limit the users who can run certain parts of the application.

Securing Windows Applications

Page 21: 10 gui 14

Slide 21 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET Framework

The Code Access Security (CAS) consists of elements such as:

Evidence

Permissions

Permission sets

Code groups

Security Policy

Code Access Security

Page 22: 10 gui 14

Slide 22 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET Framework

Role-based security uses the Principal and Identity objects to access information about the user.

The identity object consists of the user’s login name.

Principal object consists of the information about the role of the user.

Role-Based Security

Page 23: 10 gui 14

Slide 23 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET Framework

In this session, you learned that:After creating an assembly for a component, you can create a deployment project to deploy the component.

Deployment is the process of distributing the files that constitute an application.

There are two common deployment strategies available with .NET. These are:

XCOPY Deployment

Setup and Deployment projects

The Setup and Deployment Project type provides a number of templates for deploying various types of applications.

The Setup Wizard exists as a simple step-by-step project creation facility.

Visual Studio .NET provides several editors in deployment projects.

Summary

Page 24: 10 gui 14

Slide 24 of 24Session 14Ver. 1.0

GUI Applications Development Using .NET Framework

Configuration files are XML files that are used to change the application settings without recompiling an application.

There are three types of configuration files. These are:The Application configuration files

The Machine configuration files

The Security configuration files

Configuration sections are used in the configuration files to specify the information that the application reads at run-time.

The .NET Framework provides several mechanisms for protecting resources and code from the unauthorized code and users. This includes:

Code access security

Role-based security

Summary (Contd.)