Title: Challenges of Installing a 'NET Framework
1Challenges of Installing a .NET Framework
David Klitzke East Bay .NET FUNdamentals July 14,
2005
2David 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
3Agenda
- 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
4Why 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
5General 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
6Some 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
7Choices for Installation Tools
8Choices for Installation Tools
- Microsoft Windows Installer
- InstallShield
- Wise
- Other
9Microsoft 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
10InstallShield
- 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
11Supporting Multiple Features
12InstallShield Installation Architecture
13Feature Folder Hierarchy
- Each feature has a separate set of components in
an independent folder hierarchy
14Multiple Features allow Custom Installations
15Pick and Choose your Features
- Default Feature is not selectable or visible
- Choose whether to display sub-features
16Asking for a Serial Number
17Asking 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
18Add a Screen during UI Phase
- Add Customer Information Dialog after prompt for
Installation Folder
19Edit Serial Number Template
- Set ShowSerialNumber to True
- Edit SerialNumberTemplate
20Use a Windows Installer Class
- Windows Installer Classes used for Custom Actions
during - Install
- Commit
- RollBack
- Uninstall
21Get User Input from Custom Action Data
22Evaluate Serial Number
- Throw Exception on Failure
23Demo Adding a Serial Number Prompt to the Install
24Installing Assemblies into the GAC
25Installing 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
26Strongly Name the Assemblies
27Add Global Assembly Cache Folder to the Setup
Project
- This folder is not included by defaut
28Copy Assemblies into Application Folder and
Global Assembly Cache
29Use Registry Editor to make Assemblies Visible to
Visual Studio
- Adding this to installation
Add this to the registry
30Registry entry needed for Visual Studio for Add
References
With Registry Entry Without Registry
Entry
31Simple Visual Studio Add-In Project
32Simple 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
33IdeaBlade Object Relational Modeling (ORM) Tool
- Visual Studio Add-In
- Appears in Visual Studio Tools menu
34Demo 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
35Create a Visual Studio Add-In Project
36Use Add-in Wizard
37Add Properties with Wizard
Use C
Visual Studio is the application host
38Add Properties with Wizard
Enter Name and Description
Yes, Create a Tools Menu Item
39Add Properties with Wizard
Add an About Box
Summary
40Registry Changes added by Wizard
- Registry changes to Setup Project
41Add a MessageBox.Show statement with Breakpoint
- Add Reference to System.Windows.Forms
- Add using clause
- Add Message.Show statement in Connect.cs with
breakpoint
42Debug the project
- Press Debug, then Start
- When a new Visual Studio appears, press the Tools
menu to reveal the simple Add-in
43Reach the Breakpoint
- Select MyAddIn1 from Tools menu to reach the
breakpoint - Select Debug and Continue to reveal the
MessageBox
44Demo Debugging a Visual Studio Add-In Project
45Adding Visual Studio ToolBox Items
46Add Visual Studio Designers
- Automate adding of controls and tabs that would
otherwise have been done manually within Visual
Studio
47IdeaBlade ToolBox Items
48Implementation
- Use a Commit Phase Custom Action with a
ToolBoxInstaller.exe - Add Shortcut to Program Files
- Requires understanding DTE
49A Few Words on DTE
50Automatically Attaching a Database
- So your user is ready to start sample tutorials
exercises
51Problems 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
52Information 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
53Automatically Attaching a Database
- Case Example
- Implementation
- Discover the connection string
- Attach the database
- Modify the configuration files
54Case 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
55Implementation 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
56Merge 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
57Database.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\)
58Discover 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
59Attach 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
60Get the SQL Service Name
- In this example, its MSSQLSERVER
61Check if SQL Server Installed
62Check if SQL Service Running
- If not running, user has the option of aborting
the installation
63Get the SQL Server Name
- If Service Name MSSQLSERVER
- Server Name .
- Else if Service Name is like MSSQLABC
- Server Name HOSTNAME\ABC
64Try Windows Authentication
- See if you can access master database using
Integrated security
65If no Windows Authentication, prompt for SQL
Server password
- If first password check fails, ask if user wants
to try again
66Test if Tutorial Database already attached
67Attach database if not already attached
Delete log file if it already exists
68Recursively look for config files
69Fix up connection strings
70Automatic Database Installation makes it easy to
download and use IdeaBlade Tutorials
71Installation Debugging Tips and Tricks
72Turn on Windows Installer Logging
73Use Fusion Log Viewer to debug assembly binding
redirection
74Log Entry for failed assembly binding
75Q A
76References
- 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
77Thanks For Your Time
For more information davidk_at_ideablade.com
www.ideablade.com