您的位置:首页 > 移动开发

[转]Designing Applications for Windows Vista

2007-02-07 17:44 253 查看
The following best practices are for well-behaved application installations in a Windows Vista or UAC environment.

Use the Windows Installer for your setup script. Many of the following tips are already integrated into the MSI engine. Developers run the risk of not following good setup design if they use other underlying engines or try building one from scratch. MSI is a mature and proven technology.

Use versioned files and do not downgrade files during installation. File versioning ensures that the final installation state is correct when setup is complete. Without file versions, some special handing will be needed to ensure that your installation works properly for many different installation scenarios. Also, when installing versioned files, do not downgrade versions, especially shared files. Downgrading versions may be good for your application, but it frequently causes issues with other applications.

Applications should be installed in the /Programs files/ directory. Per-user configuration information should be stored in the /Users/(username)/AppData directory. User data, templates, and application-created files all have proper locations in the /Users/(username) subdirectories. Although this was not enforced in the past, since many users would run programs with full administrative privileges, applications that do not place information in the correct location are likely to fail. This is especially true when Virtualization is turned off.

Use a consistent folder location when installing shared components. Managing shared components can be problematic and should be avoided, if possible. A developer who does not install shared components consistently can end up with Component Object Model (COM) registration information pointing to older components. Other problems arise when modifications of shared components cause existing applications to fail. One way to address this issue is for applications to be built using Microsoft .NET—or Win32—versioned assemblies.

Perform setup rollback if an installation fails. Partially installed software can fail in strange and unexpected ways providing for a poor user experience. MSI supports this rollback feature.

Do not install application shortcuts all over the user's profile. While it may be tempting to add your application icon to every known exposure point in Windows, it often results in users feeling that they have lost control of their machine. Users are then forced to manually remove these shortcuts to return the machine to a desired look and feel. If the developer wants to add icons to the desktop, ask the user for permission during the installation. Windows Vista addresses discoverability of applications post install and the most recently used application list to avoid large Start menu traversing.

Avoid automatically launching background applications at user logon. Although it is possible to add programs to the startup group or 'Run' key during installation, it adds overhead to the system. Over time, the performance of the user's system can significantly degrade. If your application can benefit from a background task, allow it to be user-configurable. Also, adding a startup task via the HLKM run key may prevent a limited user account from modifying the behavior in the future. If the user wants an application to launch at login time, store the information in the run key of the HKEY_CURRENT_USER (HKCU).

Follow clean uninstall logic. A user may uninstall an application not only to free up disk space, but also to return the machine to its state prior to the application being installed. The application's uninstall process should correctly and fully remove the application. MSI defaults to the following 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 MSI).

Following the un-installation of an application, the user should be able to reinstall it with errors.

 From:http://msdn2.microsoft.com/en-us/library/aa480150.aspx
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息