Module 9: Deploying Windows Forms Applications

Total Page:16

File Type:pdf, Size:1020Kb

Module 9: Deploying Windows Forms Applications Module 9: Deploying Windows Forms Applications Contents Overview 1 Lesson: .NET Assemblies 2 Lesson: Deploying Windows Forms Applications 24 Review 46 Lab 9.1: Deploying an Application 48 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. 2002 Microsoft Corporation. All rights reserved. Microsoft, MS-DOS, Windows, Windows NT, Active X, Authenticode, FrontPage, IntelliSense, MSDN, PowerPoint, Visual Basic, Visual C#, Visual Studio, Win32, and Windows Media are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. The names of actual companies and products mentioned herein may be the trademarks of their respective owners. Module 9: Deploying Windows Forms Applications iii Instructor Notes Presentation: In this module, students learn about assemblies and the use of strong-named 120 minutes assemblies and the global assembly cache in the Microsoft® .NET Framework. Students also learn how to configure and deploy Windows Forms applications. Lab: 60 minutes After completing this module, students will be able to: Use strong-named assemblies in .NET applications. Use application configuration files to configure and use Microsoft Windows® Installer 2.0 to package and deploy .NET applications. Required materials To teach this module, you need Microsoft PowerPoint® file 2555A_09.ppt. Preparation tasks To prepare for this module: Read all of the materials for this module. Complete the demonstrations, practices and lab. iv Module 9: Deploying Windows Forms Applications How to Teach This Module This section contains information that will help you to teach this module. If students are interested in referencing code examples in other languages, point them to “Language Equivalents” in the Help documentation for the Microsoft Visual Studio® .NET development system. This section provides examples in languages such as Microsoft Visual Basic® .NET, C#, and Java. Lab 9.1, Deploying an Application is based on the Expense Report application used throughout Course 2555A, Developing Microsoft .NET Applications for Windows (Visual C#™ .NET) and is intended to simulate a real-world environment in which students will demonstrate what they learned during the lecture and practice portions of the module. The lab does not provide step-by-step detailed instructions; instead, the students are given tasks to complete in the left column and a list of resources that they can use (if they need help) in the right column. Students get the hands-on experience that they need by completing the practice activity in the module. Lesson: .NET Assemblies This section describes the instructional methods for teaching this lesson. The key points of this lesson are for the student to understand the difference between private and strong-named assemblies and the appropriate scenarios for the use of each. How to Install Also, be sure to emphasize that the GACUtile.exe utility is for use during Assemblies into the application development. For application development, assemblies should be Global Assembly Cache installed in the global assembly cache by using the .NET Framework configuration tool (Mscorcfg.msc) or Windows Installer setup projects. Lesson: Deploying Windows Forms Applications This section describes the instructional methods for teaching this lesson. In this lesson, point out to students that the deployment of Windows Forms applications is easier thanks to the support added by the .NET Framework, which avoids the old problem of dynamic link-library (DLL) versioning issues. Lab 9.1: Deploying an Application This section describes the instructional methods for teaching this lab. If a student opens the InternalBusinessApplication.sln solution file for Exercise 3, Deploying a .NET Application, the work area is initially blank. Tell students that to view the file system editor, in Solution Explorer they must right-click InternalBusinessApplication, click View, and then click File System. Module 9: Deploying Windows Forms Applications 1 Overview .NET Assemblies Deploying Windows Forms Applications Introduction In this module, you will learn about assemblies and the use of strong-named assemblies and the global assembly cache in the Microsoft® .NET Framework. You will also learn how to configure and deploy your .NET applications. Objectives After completing this module, you will be able to: Use strong-named assemblies in .NET applications. Use application configuration files to configure and use Microsoft Windows® Installer 2.0 to package and deploy .NET applications. 2 Module 9: Deploying Windows Forms Applications Lesson: .NET Assemblies What is an Assembly? What Are Private Assemblies? What Are Strong-Named Assemblies? How to Build a Strong-Named Assembly How to Call a Strong-Named Assembly Demonstration: Viewing Assembly Metadata Practice: Calling a Strong-Named Assembly How to Install Assemblies into the Global Assembly Cache Demonstration: Using the .NET Framework Configuration Tool to Work with the Global Assembly Cache Practice: Working with the Global Assembly Cache Introduction In this lesson, you will learn about the difference between private and strong- named assemblies, how to build and call strong-named assemblies. You will learn how to install strong-named assemblies in the global assembly cache and why you would want to do so. You will also learn how to use the Fusion Log Viewer (FusLogVw utility) to trace the assembly load process to troubleshoot application activation problems. Lesson objectives After completing this lesson, you will be able to: Describe the difference between private and strong-named assemblies. Build strong-named assemblies and call them from an application. Install strong-named assemblies in the global assembly cache. Use the FusLogVw utility to trace the assembly load process to troubleshoot application activation problems. Module 9: Deploying Windows Forms Applications 3 What is an Assembly? A functional unit of sharing, versioning, and identity in the .NET Framework A unit for which permissions are requested and granted Can be shared across .NET applications Introduction Applications in the .NET Framework always consist of one or more assemblies. Definition An assembly: Is a functional unit of sharing, versioning, and identity in the .NET Framework. Is a unit for which permissions are requested and granted. Can be shared across .NET applications. In the simplest case, an application can consist of one assembly that contains one managed module with all the code and resources for the application. In most scenarios, however, an application has multiple assemblies, and each assembly may have multiple files. References between assemblies are not resolved until the code making the call is executed. So, all assemblies of an application need not be present at run time. Assemblies, such as localization resources, can be retrieved on demand. All assemblies are self-describing. Each assembly contains metadata that includes the identity and version of the assembly and the types implemented by that assembly. You can use the Microsoft intermediate language (MSIL) Disassembler (Ildasm.exe) to view the contents of the assembly file. At the command prompt, type the following command: ildasm <assembly name> 4 Module 9: Deploying Windows Forms Applications What are Private Assemblies? Private assemblies Private assemblies are deployed with and used exclusively by a single application Where private assemblies can reside z Default probing process Application folder tree z Use Assembly.LoadFrom for these locations Any folder on the local computer Any folder on a remote computer A URL AssemblyAssembly PrivateAssembly;PrivateAssembly; PrivateAssemblyPrivateAssembly = = Assembly.LoadFrom("C:\\PrivateAssembly.dll");Assembly.LoadFrom("C:\\PrivateAssembly.dll"); //// ObtainObtain aa referencereference toto aa methodmethod knownknown toto existexist inin assembly.assembly. MethodInfoMethodInfo Method Method == PrivateAssembly.GetTypes()[0].GetMethod("CalculateSum");PrivateAssembly.GetTypes()[0].GetMethod("CalculateSum"); Introduction In the .NET Framework, you can create source code by using any programming language that is compatible with the .NET Framework. You then use the corresponding compiler to build a managed module. A managed module is a standard portable executable (PE) file for the Windows operating system
Recommended publications
  • A Cross-Platform Programmer's Calculator
    – Independent Work Report Fall, 2015 – A Cross-Platform Programmer’s Calculator Brian Rosenfeld Advisor: Robert Dondero Abstract This paper details the development of the first cross-platform programmer’s calculator. As users of programmer’s calculators, we wanted to address limitations of existing, platform-specific options in order to make a new, better calculator for us and others. And rather than develop for only one- platform, we wanted to make an application that could run on multiple ones, maximizing its reach and utility. From the start, we emphasized software-engineering and human-computer-interaction best practices, prioritizing portability, robustness, and usability. In this paper, we explain the decision to build a Google Chrome Application and illustrate how using the developer-preview Chrome Apps for Mobile Toolchain enabled us to build an application that could also run as native iOS and Android applications [18]. We discuss how we achieved support of signed and unsigned 8, 16, 32, and 64-bit integral types in JavaScript, a language with only one numerical type [15], and we demonstrate how we adapted the user interface for different devices. Lastly, we describe our usability testing and explain how we addressed learnability concerns in a second version. The end result is a user-friendly and versatile calculator that offers value to programmers, students, and educators alike. 1. Introduction This project originated from a conversation with Dr. Dondero in which I expressed an interest in software engineering, and he mentioned a need for a good programmer’s calculator. Dr. Dondero uses a programmer’s calculator while teaching Introduction to Programming Systems at Princeton (COS 217), and he had found that the pre-installed Mac OS X calculator did not handle all of his use cases.
    [Show full text]
  • Microsoft® C#® .NET Crash Course
    .NET Club University Of Cyprus presents: Microsoft ® C# ® .NET Crash Course Creating Windows Applications Introduction to C# .NET (Copyright © 2005-2011 Panayiotis Andreou) Course contents Overview of the Microsoft .NET Platform • Lesson 1: Creating a new Windows Application • Lesson 2: Introduction to Windows Forms • Lesson 3: Adding Controls to a Form • Lesson 4: Working with Controls • Lesson 5: Creating MDI Applications • Lesson 6: Introduction to Visual Basic • Lesson 7: Building Mobile Applications • Lesson 8: Deploying Applications 06/10/2011 C# .NET Crash Course 2 Course goals • Create a new Windows application • Create Windows Forms and add controls to them • Learn about different types of controls • Organize controls on a form • Create MDI (Multiple Document Interface) applications 06/10/2011 C# .NET Crash Course 3 Overview of the Microsoft .NET Platform What is the Microsoft .NET Platform Developer Clients Tools ASP.NET Web Databases Applications XML Web User .NET Services Experiences Framework 06/10/2011 C# .NET Crash Course 5 Core Technologies in the .NET Platform • .NET Framework • .NET Building Block Services • Visual Studio .NET • .NET Enterprise Servers 06/10/2011 C# .NET Crash Course 6 Components του .NET Framework Visual Basic ® C++ C# JScript ® … Common Language Specification ASP.NET: Web Services Windows and Web Forms Forms ADO.NET: Data and XML Base Class Library Common Language Runtime 06/10/2011 C# .NET Crash Course 7 Overview of C# .NET Syntax Comments Single-line comments are marked with (//) at the start //These are single-line comments Multiple-line comments are marked with /* * These are * multi-line comments */ 06/10/2011 C# .NET Crash Course 9 Variables Access Modifiers public The type or member can be accessed by any other code in the same assembly or another assembly that references it.
    [Show full text]
  • Quick Start Guide to Windows 10 Making Your Move to Windows 10 Quick and Simple Table of Contents
    Quick Start Guide to Windows 10 Making your move to Windows 10 quick and simple Table of Contents Understanding your desktop Security, privacy and scam protection Take a tour of the Windows 10 desktop. Learn how to be more Your security and privacy mean a lot to us. Windows 10 features a productive using the Windows Start menu, Taskbar and Action full security dashboard, with personal privacy settings and our most center. advanced safety measures yet. Setup and personalization Accessibility Make it yours! Windows 10 is all about you, from personalized Microsoft’s accessibility features make tasks easier for users with a backgrounds to custom language choices. Create a Microsoft disability. Enlarge screen text to make it easier to read and change account to unlock the full Microsoft universe of features. narration and dictation settings. Apps and programs Windows updates and upgrades Now that you’ve made yourself at home, it’s time to take Windows 10 provides regular updates to keep your device Windows 10 to the next level: adding apps. Whether you want secure and bring new features to you. Windows 7 users can find to tackle more tasks around the house or at work, or have fun resources to transition to Windows 10. playing games, it’s all here. Tips and tricks Additional resources Do more with Windows 10! Our tips and tricks will get you off and We’re here to help you make the most of Windows 10 from Day running in no time. 1 to Day 101—and beyond! Get to know these resources.
    [Show full text]
  • Microsoft Windows 7 Foundation Training Manual
    Microsoft Windows 7 Foundation Training Manual. Table of Contents Section 1: Getting Started .............................................................................................................. 1 Lesson 1.1: The Basics of Windows 7.................................................................................................... 2 What’s New in Windows 7? .................................................................................................................................. 2 Windows 7 Versions ............................................................................................................................................. 6 Logging In ............................................................................................................................................................ 6 The Windows 7 Desktop ....................................................................................................................................... 8 Lesson 1.2: Interacting with the Computer ........................................................................................ 12 Pointing the Mouse ............................................................................................................................................ 12 Using Click and Double-Click ........................................................................................................................... 12 Using Click and Drag .......................................................................................................................................
    [Show full text]
  • Lab 5.1.4 Using the Windows Calculator with Network Addresses
    CCNA Discovery Networking for Home and Small Businesses Lab 5.1.4 Using the Windows Calculator with Network Addresses Objectives • Switch between the two Windows Calculator modes. • Use Windows Calculator to convert between decimal, binary, and hexadecimal. • Use Windows Calculator to determine the number of hosts in a network with powers of 2. Background / Preparation Network technicians work with binary, decimal, hexadecimal numbers with computers and networking devices. In this lab you will use the Windows Calculator application to convert between the binary, decimal, and hexadecimal number systems. You will also use the powers function to determine the number of hosts that can be addressed based on the number of bits available. The following resources are required: • PC with Windows XP installed and functional Step 1: Access Windows Calculator and determine mode of operation a. From the Start button menu, select All Programs > Accessories, and click on Calculator. An alternate method of starting the Calculator application is to access the Start menu, click on Run, type calc and press Enter. Try both methods. b. Once the Calculator application opens, select the View menu option. c. Which mode [Standard | Scientific] is currently active? ____________________________________ d. Select the Standard mode. This is a basic mode for simple calculations. How many mathematical functions are available in this mode? __________________________________________________ e. From the View menu option, select the Scientific Calculator mode. All contents are Copyright © 1992–2007 Cisco Systems, Inc. All rights reserved. This document is Cisco Public Information. Page 1 of 6 CCNA Discovery Networking for Home and Small Businesses f. How many mathematical functions are available in this mode? __________________________ Step 2: Convert between number systems a.
    [Show full text]
  • Introduction to Windows 10 Part 2
    Introduction to Windows 10 Part 2 Higham and Rushden U3A In this presentation we will have a quick look at the following: • Window structure • Ease of Access • File Deletion • Control Panel And the following applications: • Sound • Audio CDs Notepad • Ripping music from CDs WordPad • Digital pictures Paint Calculator Photos Windows Defender Windows Firewall Windows Update Window Structure When you open a folder, or start a Windows function or application program on the Desktop, it normally appears as a window that can be moved and resized. File Explorer (the icon) is shown below. Click the Maximize button to view the window using the whole screen, and the Restore button appears in place of it. Note that the ribbon view as shown here is now the norm for most Microsoft programs, but not all: Notepad, for example, still has an older-style Menu Bar. Ease of Access Windows 10 Settings also allow you to set up Ease of Access options on your computer, to improve accessibility. First open Settings, then click on Ease of Access. Select Magnifier to turn Magnifier on, invert colours and enable tracking (to have Magnifier follow the keyboard focus or the mouse cursor). Select Mouse to adjust the pointer size, change the pointer colour or use the numeric keypad to move the mouse around the screen. You can also manage use of the screen, keyboard and other options such as cursor thickness. To make the typing cursor easier to spot, for example, select “Other options” then drag the slider for “Cursor thickness” until it is the size you’d like.
    [Show full text]
  • Windows Powershell 2 for Dummies
    Windows PowerShell™ 2 FOR DUMmIES‰ by Steve Seguis Windows PowerShell™ 2 For Dummies® Published by Wiley Publishing, Inc. 111 River Street Hoboken, NJ 07030-5774 www.wiley.com Copyright © 2009 by Wiley Publishing, Inc., Indianapolis, Indiana Published by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permit- ted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http:// www.wiley.com/go/permissions. Trademarks: Wiley, the Wiley Publishing logo, For Dummies, the Dummies Man logo, A Reference for the Rest of Us!, The Dummies Way, Dummies Daily, The Fun and Easy Way, Dummies.com, Making Everything Easier, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/ or its affi liates in the United States and other countries, and may not be used without written permission. Windows PowerShell is a trademark of Microsoft Corporation in the United States and/or other countries. All other trademarks are the property of their respective owners.
    [Show full text]
  • 4 Working with WSH Objects
    4 Working with WSH objects In the preceding chapter I have discussed a few basics of script programming. We have also used a few objects, methods and properties. In this chapter I would like to extend your knowledge how to use the Windows Scripting Host, to automate certain tasks. Take a look how to read the properties of the WScript object and display them in a dialog box. This allows you to retrieve the most impor- tant information from WSH and of the current script. Or access the environment variables of your operating system using a script. Another sample demonstrates how to access the arguments passed to a WSH script (a topic which we know from chapter 1). Accessing other objects requires creating these objects. Below I will discuss, how the methods CreateObject and GetObject are used with WScript objects. And I like to show how to launch an external application from a script using the Run method. NOTE: At this place I recommend download a copy of the WSH Programmers Reference from Microsoft's website http://msdn.microsoft.com/scripting. This reference comes handy for the upcoming chapters. Using the WScript object The WScript object is the application object of the Windows Script Host. This object is exposed automatically to the running script. So you need not to create a reference to the WScript object. The object exposes several methods and properties. In previous chapters we already have used the methods Echo and Quit of this object. Below I will show how you can access the object's proper- ties.
    [Show full text]
  • How to Remove Bloatware from Windows 10 While Windows 10 Does Come with a Reasonably Large Amount of Bloatware, It Is Also Relatively Easy to Get Rid of It
    How to Remove Bloatware from Windows 10 While Windows 10 does come with a reasonably large amount of bloatware, it is also relatively easy to get rid of it. Microsoft has provided two options: using the traditional uninstall feature or by using the PowerShell. The Traditional Uninstall Bloatware isn’t listed within the Programs and Features list (Windows + X, then F) that you would normally use to uninstall a program. Microsoft and other manufacturers who deliver products with bloatware stand to profit from your using them, so making it easy to uninstall isn’t in their best interest. You can right-click the application and select uninstall from the context menu. This appears to work for several apps included in the Windows 10 installation package, such as Money, News, Sports, and a few others clogging up your Start menu. Use Powershell to Hide or Remove Apps Microsoft has made it simple to remove the more cosmetic items attached to Windows 10, but you’ll quickly find that not all apps are considered equal. Those apps Microsoft considers part of the core Windows 10 experience will require you to use the PowerShell to hide, or remove them. Others, such as Cortana simply cannot be removed from your system, despite your best efforts. The PowerShell is an important part of the Windows command line. In this case, you can use the PowerShell to either hide or remove the apps installed with Windows 10. Open the PowerShell command line by typing PowerShell into your Start menu search bar. The best match should be Windows PowerShell.
    [Show full text]
  • Copyrighted Material
    02_584065 ftoc.qxd 3/7/05 7:23 PM Page vii Contents Introduction xvii Chapter 1: What Is Programming? 1 The History of Programming 1 What Is Programming? 4 Why So Many Programming Languages? 4 Different Code, Same Results 6 BASIC 7 Atari BASIC 7 C 7 C++ 7 COBOL 8 FORTRAN 8 Java 8 JavaScript 9 Mathematica 9 Pascal 9 Perl 9 Python 9 QBASIC 9 Smalltalk 9 Visual Basic 9 VRML 10 Programs Needed to Create Programs 11 Development Environment 11 Compilers 11 Summary COPYRIGHTED MATERIAL 12 Chapter 2: Why Learn to Program? 13 Why Program? 13 The “Career” Programmer 14 Problem Solving 16 How Big Is the Project? 17 Is the Project Time Critical? 17 Work or Hobby? 17 02_584065 ftoc.qxd 3/7/05 7:23 PM Page viii Contents Because You Want to Contribute 18 Just for Fun 18 Fame 18 What to Learn? 19 Programming Avenues 19 Traditional Programming 19 Web Programming 21 Programming Myths and Facts 23 Myth 1 — Programming Tools Cost a Lot of Money 23 Myth 2 — You Need a Degree in Computer Science to be a Programmer 24 Myth 3 — Learning to Program Takes Years 24 Myth 4 — Programming Is Just for Young People 24 Myth 5 — I’ll Need a Top-of-the-Range Super-Duper Computer to Program On 24 Myth 6 — Programming Is Addictive! 24 Myth 7 — Programming Languages Change All the Time 25 Myth 8 — Once You’ve Learned One Programming Language, Learning Others Is Easier 25 Summary 25 Chapter 3: How Computers “Read” Code 27 Reading Code 27 Top Down 28 Breaking Up Code 31 The Statement 35 Functions/Procedures 36 The Sentences and Paragraphs of Programming 37 Lines of Code 37 Paragraphs
    [Show full text]
  • Microsoft Windows Tips
    Microsoft Windows Tips These tips have been accumulated over the years for the SISD Announcements. They are in no particular order. Moving an Off-Screen Window Sometimes a window will get positioned off of your screen where you can't see the title bar. It is possible to move the window, and it's not that hard to do. Just open the program that is giving you the problem, and do the following: 1. Press Alt + spacebar + M. 2. Press the down arrow repeatedly until your title bar appears. Now you have full use of the title bar, and can minimize, maximize, and close your program more easily. Note that you can use this technique to move a window in ANY direction; just press Alt + spacebar + M and then press the appropriate arrow key. Windows Logo Key Shortcut Combinations Have you ever wondered what the Windows Logo key on your keyboard was for? Try the following shortcuts using that key. W stands for the Windows Logo key. W Open Start menu W + E Open Windows Explorer W + F Find a file or folder W + F1 Start Windows Help W + M Minimize all windows with minimize buttons SHIFT + W + M Maximize all windows that were minimized with the previous shortcut W + R Display the Run dialog box W + TAB Select open programs listed in the taskbar, in order. Press ENTER to activate the selected program. Maximize a Window Using the Title Bar If you ever have trouble clicking on the Maximize button, a quick way to maximize an application window is to double-click on the title bar.
    [Show full text]
  • Windows Script Host Getting Started
    Windows Script Host Page 1 of 340 Windows Script Host Windows Script Host In This Section Getting Started WSH Basics Running Your Scripts Basic Windows Script Host Tasks Security and Windows Script Host Reference © 2001 Microsoft Corporation. All rights reserved. Build: Topic Version 5.6.9309.1546 Windows Script Host Getting Started In This Section What's New in WSH Description of the new features in WSH 5.6. Document Conventions file://C:\Documents%20and%20Settings\latham\Local%20Settings\Temp\~hh9AC5.htm 9/3/2003 Windows Script Host Page 2 of 340 Description of the syntax and conventions used in WSH 5.6 help documentation. Related Sections WSH Reference List of elements that make up WSH Reference. WSH Basics Learn the basics of WSH. © 2001 Microsoft Corporation. All rights reserved. Build: Topic Version 5.6.9309.1546 Windows Script Host What's New In WSH 5.6 Several areas of functionality have been addressed in this latest version of the Windows Script Host (version 5.6). l Argument handling has been improved — Handling and documenting command line arguments is simpler. The process of integrating your scripts with other command line scripts has been simplified, and it is easier to create scripts that can supply the user with help information. Refer to the following table for information on the WSH language features that connect you to this new functionality. To Learn About See Grouping your script's switches together. <runtime> Element Defining your script's named switches. <named> Element Defining your script's unnamed switches. <unnamed> Element Making your script self-documenting.
    [Show full text]