mdunn's WebLog

Ten Tips for Well Behaved Application Installations

Ten Tips for Well Behaved Application Installations

 

- Micheal Dunn – Windows Deployment
 

1.                Use Windows Installer for your setup script

Many of the below tips are accounted for in the Windows Installer (MSI) engine, and you risk not following good setup design with other engines or building your own from scratch. Windows Installer is very mature now and is up to version 3.0.

2.                Use versioned files and don’t downgrade files on install

File versioning ensures the final install state is correct when setup is complete. Without file versions some special handing will be needed to ensure your install works properly over many different install scenarios. Also when installing versioned files don’t downgrade versions, especially shared files!! It may be good for your application to downgrade, but almost always causes issues with other applications.

3.                Use correct folder for correct file type or risk post install app failures

This tip might be more about application runtime issues than install. Applications should be installed into programs files today. This folder though is not appropriate for user data. User data, templates, and application created all have proper homes in the Documents and Settings branches in Windows. Older versions of Windows did not enforce this well with many users running as admin today. In the future if you don’t follow this tip your application likely will just fail.

4.                When installing shared components use a consistent folder location or risk making a big mess!!

Handling shared files in an install is hard, and if you can avoid it…do!! If you don’t install shared components consistently you could end up with bad COM registration info pointing to older components. This is also the typical support problem where multiple DLLs at different version reside in different folders. Depending on app load order and how DLL is loaded the system will return different results. Typically this leads to random issues or people needing to uninstall applications and reinstall in a certain order. To solve this issue long term programs should start using .NET or Win32 versioned assemblies.

5.                Be clear to the user when installing shared components or updating OS pieces

When users install an application they don’t typically expect other applications to break. You run the risk of breaking application whenever you installed shared components on the system. The user should be informed or shared component installs that could affect other applications. You should note in read me or support info how to correctly remove the shared components you install if  is left behind on your application uninstall do to reference count handling. If your application can follow more of a per user isolated application model you will not have to deal with the hard issues of shared component updates. Visiting a web site for example doesn’t break a machine typically, it’s because the site doesn’t touch shared machine state.

6.                Don’t let a partial install succeed, have setup rollback

When a setup is complete it should be in a state as tested by your release team. Allowing a partial setup to succeed just confuses the user as to what state their machine is really in. Windows Installer already has such support, and should leverage this model in custom actions you add to your installer.

7.                Don’t spam the users system with application shortcuts

Well as tempting as it may be to add your application icon to every known exposure point in Windows it’s one of the ways a user feels they have lost control of their machine. Post install a user has to manually remove icons to get the machine back to how they like it to look. If you do need to add icons to the desktop for example, ask the user during the install if it’s OK to do so. Newer versions of Windows address discoverability of applications post install and most recently used app list to avoid large start menu traversing.

8.                Don’t add background applications to the startup group or run branch during install

While it’s possible to add components to startup group or run branch during install, just don’t do it. One of the reasons people uninstall applications is their machine has slowed down due to all the added background tasks apps have added over time. Instead let this happen on application first run or in the application feature UI if the user really wants the background task added to their machine working set. The mere fact of installing the app shouldn’t hurt machine performance, and users will be less likely to uninstall your app in the first place. Any machine can only handle so many background processes and there isn’t a good mechanism at install time to judge how much headroom a machine has left for your task. Definitely at uninstall do remove all your background tasks from the system to avoid bad error prompts and return system performance.

9.                Follow clean uninstall logic

A user uninstalls an application to free up disk space, but also does so to try to return their machine to the state before the application was installed. The application’s uninstaller should correctly and fully remove the application. Windows Installer defaults to these rules.

    • All non-shared application files and folders.
    • Shared application files whose reference-count (refcount) reaches zero.
    • Registry entries, except for keys that might be shared by other programs.
    • All shortcuts from the Start menu that the application created at the time of installation.
    • User preferences may be considered user data and left behind, but an option to do a completely clean removal should be included.
    • The uninstaller itself (if not using Windows Installer)

10.           Uninstall removal must be clean enough to allow the application to be reinstalled later!!!

This is a very important rule. If a user can’t reinstall your product after they uninstall it they will either need to reinstall Windows or return your product. Neither solution is enjoyable to you or the user. Many uninstall and reinstall tests are conducted under clean machine or single app scenarios. You should broaden your test scenarios to cover more mixes of versions especially when dealing with shared components in the installs too.

 

Published Friday, April 09, 2004 10:35 PM by mdunn

Comments

 

Koji Ishii said:

I agree with this, except #8.
#8 makes sense, but it's not practical. Such background applications often require writes to HKLM registry, or All Users' startup folder. MSI can write to them, but apps can't if the user is not an admin. It is important for apps not to write to where non-admin cannot write to, or fail gracefully in such cases. For that purpose, I think breaking rule #8 is ok.
April 10, 2004 3:30 PM
 

KMorrill's WebLog said:

April 10, 2004 5:45 PM
 

My .NET said:

April 11, 2004 9:04 AM
 

Kentasy said:

You can set it up so that the app can read/write to a registry key (and only that key !) during the install.

This would let non-admins run the app.
April 11, 2004 11:33 AM
 

Micheal Dunn said:

Yup rule #8 is hard...though much of the time I think most app startup items can be done directly in the per user startup group (best) or the HKCU run branch...

Make it easy so app install doesn't affect all users unless it really has to...

Agree though some apps need to affect the whole system like an anti-virus app.
April 12, 2004 2:55 PM
 

davidds said:

great set of tips and a must read for anyone developing an app.
April 17, 2004 5:23 PM
 

public MattBerther : ISerializable said:

During the past few weeks, I've learned way more about InstallShield than I ever wanted to know. Several months ago, I was tasked with creating an installer for one of our applications at work. Thanks to DevStudio, the installer originally...
April 19, 2004 10:48 PM
 

Shelly said:

Your Artciles and Comments helped me finish my paper today, many thanks !

May 25, 2004 6:39 AM
 

Micheal Dunn said:

Well good deal...what was the paper exactly?
May 25, 2004 12:26 PM
 

s. said:

nice site
June 14, 2004 9:01 PM
 

s. said:

Well good deal...what was the paper exactly?
June 14, 2004 9:07 PM
 

dianying xia zai said:

http://www.dmoz.net.cn/ wangzhidaquang
http://www.86dmoz.com/ jingpingwangzhi
http://www.kamun.com/ mianfeidianying
http://movie.kamun.com/ dianyingxiazai
http://music.kamun.com/ MP3 free download
http://www.pc530.net/ diannaoaihaozhe
http://www.5icc.com/ duangxingcaixingxiazha
http://www.dianyingxiazai.com/ dianyingxiazai
http://www.yinyuexiazai.com/ yinyuexiazai
August 1, 2004 11:13 AM
 

gool said:

August 2, 2004 3:09 AM
 

Drinks - Mixology » KMorrill’s WebLog : April 2004 - Posts said:

January 6, 2008 1:10 AM
Anonymous comments are disabled

This Blog

Syndication

Tags

No tags have been created or used yet.

Archives


© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker