Handwritten Text Recognition for manuscripts and early printed texts
10 gui 14
1. GUI Applications Development Using .NET Framework
Objectives
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
Ver. 1.0 Session 14 Slide 1 of 24
2. GUI Applications Development Using .NET Framework
Deploying .NET Applications
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
Ver. 1.0 Session 14 Slide 2 of 24
3. GUI Applications Development Using .NET Framework
XCOPY Deployment
• 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 /s switch
• The syntax of the XCOPY command is: indicates that
all
XCOPY <source path> <target path> /s subdirectories
The limitations of XCOPY deployment are: are to be
copied as
It requires all files such as compiled .exe files, .dll files well.
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.
Ver. 1.0 Session 14 Slide 3 of 24
4. GUI Applications Development Using .NET Framework
Visual Studio .NET Deployment Tools
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.
Ver. 1.0 Session 14 Slide 4 of 24
5. GUI Applications Development Using .NET Framework
Visual Studio .NET Deployment Tools (Contd.)
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
Ver. 1.0 Session 14 Slide 5 of 24
6. GUI Applications Development Using .NET Framework
Just a minute
What is the extension of the Windows Installer file?
Answer:
.msi
Ver. 1.0 Session 14 Slide 6 of 24
7. GUI Applications Development Using .NET Framework
Using Deployment Project Editors
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
Ver. 1.0 Session 14 Slide 7 of 24
8. GUI Applications Development Using .NET Framework
Demo: 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.
Ver. 1.0 Session 14 Slide 8 of 24
9. GUI Applications Development Using .NET Framework
Demo: 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.
Ver. 1.0 Session 14 Slide 9 of 24
10. GUI Applications Development Using .NET Framework
Implementing ClickOnce
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.
Ver. 1.0 Session 14 Slide 10 of 24
11. GUI Applications Development Using .NET Framework
Deploying an Application Using ClickOnce
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.
Ver. 1.0 Session 14 Slide 11 of 24
12. GUI Applications Development Using .NET Framework
Demo: 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.
Ver. 1.0 Session 14 Slide 12 of 24
13. GUI Applications Development Using .NET Framework
Demo: 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.
Ver. 1.0 Session 14 Slide 13 of 24
14. GUI Applications Development Using .NET Framework
Demo: Publishing a ClickOnce Application at the Web Server
Problem Statement:
Package and deploy the EmployeeReport application at Web
server using ClickOnce.
Ver. 1.0 Session 14 Slide 14 of 24
15. GUI Applications Development Using .NET Framework
Demo: 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.
Ver. 1.0 Session 14 Slide 15 of 24
16. GUI Applications Development Using .NET Framework
Configuration Files
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.
Ver. 1.0 Session 14 Slide 16 of 24
17. GUI Applications Development Using .NET Framework
Types of Configuration Files
There are three types of configuration files. These are:
Application configuration files
Machine configuration files
Security configuration files
Ver. 1.0 Session 14 Slide 17 of 24
18. GUI Applications Development Using .NET Framework
Just 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>
Ver. 1.0 Session 14 Slide 18 of 24
19. GUI Applications Development Using .NET Framework
Configuring Applications
The .NET Framework allows developers and administrators
to control the way applications run by changing the
application settings in the application configuration file.
Ver. 1.0 Session 14 Slide 19 of 24
20. GUI Applications Development Using .NET Framework
Securing Windows Applications
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.
Ver. 1.0 Session 14 Slide 20 of 24
21. GUI Applications Development Using .NET Framework
Code Access Security
The Code Access Security (CAS) consists of elements such
as:
Evidence
Permissions
Permission sets
Code groups
Security Policy
Ver. 1.0 Session 14 Slide 21 of 24
22. GUI Applications Development Using .NET Framework
Role-Based Security
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.
Ver. 1.0 Session 14 Slide 22 of 24
23. GUI Applications Development Using .NET Framework
Summary
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.
Ver. 1.0 Session 14 Slide 23 of 24
24. GUI Applications Development Using .NET Framework
Summary (Contd.)
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
Ver. 1.0 Session 14 Slide 24 of 24
Notes de l'éditeur
Start the session by sharing the session objectives with the students.
Using this slide, discuss with the students that after an application is created, it needs to be installed on the target machine for the users to use it. Since an application may consist of several files it is essential that all the different files must be packaged and then deployed on the target computer. This ensures that none of the files are missed. Discuss the two different strategies for deploying the application using the following slides.
Using this slide, explain the purpose and syntax of XCOPY command. Also discuss with the students that XCOPY command has several limitations because of which Visual Studio .NET Deployment Tools are used.
Use this and the next slide to discuss with the students that the deployment tool helps to package all the required files. In addition, it helps to perform several other tasks as well. It would be a good teaching practice to demonstrate the deployment process to the students.
Reiterate the concepts taught earlier by asking the given question.
Use this slide to discuss the deployment process and deployment project editors(in brief). The faculty must insist that the students read about the project editors from the SGs at their home.
Conduct the activity stated in the slide in a collaborative mode in the class.
Conduct the activity stated in the slide in a collaborative mode in the class.
Use this slide to discuss this new feature, “ClickOnce” for packaging and deploying the Visual Studio .NET projects. Also discuss with the students that there are two activities in the chapter that will help them to understand the process used by ClickOnce in a better manner.
The faculty can just iterate through these steps verbally as there are two activities in the next sections that will help to demonstrate the ClickOnce feature for packaging and deploying applications.
Conduct the activity stated in the slide in a collaborative mode in the class.
Conduct the activity stated in the slide in a collaborative mode in the class.
Conduct the activity stated in the slide in a collaborative mode in the class. Note: The faculty must ensure that IIS is installed for conducting this activity
Conduct the activity stated in the slide in a collaborative mode in the class.
Discuss with the students that several configuration files are created to specify certain settings. The biggest advantage of these configuration files is that settings can be applied without having to recompile the applications.
Discuss the three types of configuration files. You can use the following content from the SG to explain the three types of files: Application configuration files provide a way of overriding the metadata in assemblies without having to rebuild the application. The name of an application configuration file is the name of the application with the .config extension. For example, an application called myApplication.exe will have a configuration file called myApplication.exe.config. Machine configuration files include settings, such as security settings that are applied to all the files of a computer. The name of a machine configuration file is machine.config. The location of this file is: %SystemRoot%\\Microsoft.NET\\Framework\\<Version>\\CONFIG\\ Here, <Version> represents the version of the .NET Framework installed on the machine. Security configuration files contain information about permission sets and code group hierarchy. A permission set is a group of permissions that can be associated with a group of code. A code group consists of a membership condition and a set of permissions. These files contain information related to the code access security system. The following topics discuss in detail about the application configuration file. This is because we are mainly concerned with the configuration of applications
Reiterate the concepts taught earlier by asking the given question.
Using this and the next slide, discuss the application configuration files with the students. The faculty can also use the table given in the SG to discuss some common elements included in an application configuration file.
Using this and the next 2 slides, discuss with the students that an application needs to be secured from unauthorized access. This is because if any changes are made in the code the application may not execute at all unless the entire application is recompiled, packaged, and deployed. Also, if any of the resources are made unavailable, the application may not execute at all.
You can summarize the session by using the summary given in the slides. In addition, you can also ask students summarize what they have learnt in this session.