Challenges of Installing a 'NET Framework - PowerPoint PPT Presentation

1 / 77
About This Presentation
Title:

Challenges of Installing a 'NET Framework

Description:

Installing a Visual Studio Add-In. Adding Visual Studio ToolBox Items ... Add Message.Show statement in Connect.cs with breakpoint. Debug the project ... – PowerPoint PPT presentation

Number of Views:44
Avg rating:3.0/5.0
Slides: 78
Provided by: ward98
Category:

less

Transcript and Presenter's Notes

Title: Challenges of Installing a 'NET Framework


1
Challenges of Installing a .NET Framework
David Klitzke East Bay .NET FUNdamentals July 14,
2005
2
David Klitzke
  • Software Consultant for IdeaBlade, a startup
    company providing a Rapid Application Development
    for .NET
  • Develop and deliver training and webinars
  • Develop software to install tutorial exercises
  • Did the initial port to InstallShield
  • Currently, assisting with port to .NET 2.0
  • Previously, senior software engineering manager
    for Sun Microsystems and Unisys

3
Agenda
  • Why is installation important for a Framework?
  • Choices for Install Tools
  • The Challenges
  • Supporting Multiple Features
  • Asking for a Serial Prompt
  • Installing Assemblies into the GAC
  • Installing a Visual Studio Add-In
  • Adding Visual Studio ToolBox Items
  • Installing and Attaching a Database
  • Debugging Tips and Tricks

4
Why is installation important for a Framework?
  • Frameworks are supposed to make life easy,
    therefore
  • They must be easy to install
  • They must not require additional steps after the
    installation to get started
  • They must allow simple quick installations as
    full-featured installations
  • The installation process should leave a favorable
    impression

5
General Challenges for Developing Installation
Software
  • Requires esoteric knowledge
  • Long times for builds, installs, and uninstalls
  • Requires support for multiple versions of
    software
  • Can be notoriously difficult to debug
  • Not glamorous

6
Some Specific Challenges
  • Supporting Multiple Features
  • Asking for a Serial Prompt
  • Installing Assemblies into the GAC
  • Installing a Visual Studio Add-In
  • Adding Visual Studio ToolBox Items
  • Installing and Attaching a Database

7
Choices for Installation Tools

8
Choices for Installation Tools
  • Microsoft Windows Installer
  • InstallShield
  • Wise
  • Other

9
Microsoft Windows Installer
  • Advantages
  • Requires no additional purchase as it is built
    into Visual Studio
  • Almost all other installation tools use the
    Windows Installer
  • Installation technology most developers are
    familiar with
  • Disadvantages
  • Doesnt support multiple features
  • Few options to modify installation sequence
  • Opaque interface to Installer database
  • Documentation is very poor

10
InstallShield
  • Advantages
  • Supports multiple features
  • Many options for modifying and altering
    installation sequence
  • Presents easy access to Installer database
  • Lots of additional features
  • Disadvantages
  • Pricey
  • Not familiar to most developers
  • Proprietary scripting tools could lead to vendor
    lock-in

11
Supporting Multiple Features
  • with InstallShield

12
InstallShield Installation Architecture
13
Feature Folder Hierarchy
  • Each feature has a separate set of components in
    an independent folder hierarchy

14
Multiple Features allow Custom Installations
15
Pick and Choose your Features
  • Default Feature is not selectable or visible
  • Choose whether to display sub-features

16
Asking for a Serial Number
  • with Windows Installer

17
Asking for a Serial Number
  • Add a Screen during UI Phase
  • Edit Serial Number Template
  • Use a Windows Installer Class
  • Add a Custom Action for the Commit Phase which
    executes the Installer Class
  • Specify Custom Action Data
  • During the install, get User Input
  • Evaluate the Serial Number

18
Add a Screen during UI Phase
  • Add Customer Information Dialog after prompt for
    Installation Folder

19
Edit Serial Number Template
  • Set ShowSerialNumber to True
  • Edit SerialNumberTemplate

20
Use a Windows Installer Class
  • Windows Installer Classes used for Custom Actions
    during
  • Install
  • Commit
  • RollBack
  • Uninstall

21
Get User Input from Custom Action Data
22
Evaluate Serial Number
  • Throw Exception on Failure

23
Demo Adding a Serial Number Prompt to the Install
24
Installing Assemblies into the GAC

25
Installing Assemblies into the GAC
  • Goal is make your assemblies easily accessible to
    Visual Studio developers
  • Strongly name your assemblies
  • Install into Application Folder and Global
    Assembly Cache
  • Modify Registry so developers can reference them
    with Visual Studio

26
Strongly Name the Assemblies
27
Add Global Assembly Cache Folder to the Setup
Project
  • This folder is not included by defaut

28
Copy Assemblies into Application Folder and
Global Assembly Cache
29
Use Registry Editor to make Assemblies Visible to
Visual Studio
  • Adding this to installation

Add this to the registry
30
Registry entry needed for Visual Studio for Add
References
With Registry Entry Without Registry
Entry
31
Simple Visual Studio Add-In Project

32
Simple Visual Studio Add-In Project
  • IdeaBlade Object Relational Modeling (ORM) Tool
  • Walkthrough on
  • Example is from MSDN article
  • How to use a wizard to create a Simple Add-In
  • How to set breakpoints in a Simple Add-In

33
IdeaBlade Object Relational Modeling (ORM) Tool
  • Visual Studio Add-In
  • Appears in Visual Studio Tools menu

34
Demo Steps
  • Create a Visual Studio Add-In Project
  • Use Add-In Wizard to set Project Properties
  • Add a MessageBox.Show to Project
  • Set a Breakpoint
  • Debug the project from within Visual Studio

35
Create a Visual Studio Add-In Project
36
Use Add-in Wizard
37
Add Properties with Wizard
Use C
Visual Studio is the application host
38
Add Properties with Wizard
Enter Name and Description
Yes, Create a Tools Menu Item
39
Add Properties with Wizard
Add an About Box
Summary
40
Registry Changes added by Wizard
  • Registry changes to Setup Project

41
Add a MessageBox.Show statement with Breakpoint
  • Add Reference to System.Windows.Forms
  • Add using clause
  • Add Message.Show statement in Connect.cs with
    breakpoint

42
Debug the project
  • Press Debug, then Start
  • When a new Visual Studio appears, press the Tools
    menu to reveal the simple Add-in

43
Reach the Breakpoint
  • Select MyAddIn1 from Tools menu to reach the
    breakpoint
  • Select Debug and Continue to reveal the
    MessageBox

44
Demo Debugging a Visual Studio Add-In Project
45
Adding Visual Studio ToolBox Items

46
Add Visual Studio Designers
  • Automate adding of controls and tabs that would
    otherwise have been done manually within Visual
    Studio

47
IdeaBlade ToolBox Items
48
Implementation
  • Use a Commit Phase Custom Action with a
    ToolBoxInstaller.exe
  • Add Shortcut to Program Files
  • Requires understanding DTE

49
A Few Words on DTE
50
Automatically Attaching a Database
  • So your user is ready to start sample tutorials
    exercises

51
Problems with manually installing a database
  • Many users dont have DB expertise and have
    trouble following database installation
    instructions
  • Many users dont know relevant information such
    as DB instance name, host name, SQL Server
    password
  • Even if database can be easily installed,
    connection strings in applications need to fixed
    up

52
Information needed for Automatic Database
Installation
  • Is SQL Server installed?
  • What is database service name?
  • Is database service running?
  • What is database instance name?
  • Is database already attached?
  • Does database require Windows Authentication or
    SQL Server paswords

53
Automatically Attaching a Database
  • Case Example
  • Implementation
  • Discover the connection string
  • Attach the database
  • Modify the configuration files

54
Case Example
  • To promote its .NET framework product, IdeaBlade
    makes it as easy as possible for potential
    customers to exercise the IdeaBlade software by
  • Automatically attaching the Tutorial database
  • Fixing up the connection strings in the
    configuration files for the sample applications
  • Providing easy-to-use interface for trying the
    applications

55
Implementation Strategy
  • Add starting solutions, completed solutions, and
    documentation during the installation using Merge
    Modules
  • Add a Windows Installer Class that executes
    during the Commit phase of the installation
    which
  • Discovers the connection string
  • Attaches the Tutorials database if unattached
  • Fixes up the configuration files for the Tutorial
    exercises

56
Merge Modules for Tutorial Exercises
  • Merge Modules provide a modular approach to
    adding components to an installation
  • Promotes reuse over different setup projects
  • IdeaBlade Tutorials have over 300 folders and
    5,000 files

57
Database.Install Windows Installer Class
  • Executes during Commit phase (after Tutorial
    solutions have been installed)
  • Single input parameter is folder name of the
    target installation (TARGETDIR\)

58
Discover the Connection String
  • Get the SQL Service Name
  • Check if SQL Server SW is installed
  • Check if the SQL Service is running
  • If Service running, get the SQL Server Name
  • Try Windows Authentication
  • If Windows Authentication fails, prompt for SQL
    Server password

59
Attach Database and Fix-up Config Files
  • Test if Tutorial Database already attached
  • Attach database if not already attached
  • Recursively look for config files
  • Fix up connection strings

60
Get the SQL Service Name
  • In this example, its MSSQLSERVER

61
Check if SQL Server Installed
62
Check if SQL Service Running
  • If not running, user has the option of aborting
    the installation

63
Get the SQL Server Name
  • If Service Name MSSQLSERVER
  • Server Name .
  • Else if Service Name is like MSSQLABC
  • Server Name HOSTNAME\ABC

64
Try Windows Authentication
  • See if you can access master database using
    Integrated security

65
If no Windows Authentication, prompt for SQL
Server password
  • If first password check fails, ask if user wants
    to try again

66
Test if Tutorial Database already attached
67
Attach database if not already attached
Delete log file if it already exists
68
Recursively look for config files
69
Fix up connection strings
70
Automatic Database Installation makes it easy to
download and use IdeaBlade Tutorials
71
Installation Debugging Tips and Tricks

72
Turn on Windows Installer Logging
73
Use Fusion Log Viewer to debug assembly binding
redirection
74
Log Entry for failed assembly binding
75
Q A

76
References
  • Referencing the DTE
  • http//msdn.microsoft.com/library/default.asp?url
    /library/en-us/vsintro7/html/vxconreferencingdteob
    ject.asp
  • Debugging a Simple Add-In Project
  • http//msdn.microsoft.com/library/default.asp?url
    /library/en-us/vsdebug/html/vxwlkwalkthroughdebugg
    ingadd-inproject.asp
  • Enable Windows Installer Logging
  • http//support.microsoft.com/default.aspx?scidkb
    en-us223300

77
Thanks For Your Time
For more information davidk_at_ideablade.com
www.ideablade.com
Write a Comment
User Comments (0)
About PowerShow.com