Deploy Windows Applications with Visual Studio.NET, Part 1
Using Visual Studio .NET Installer for Deploying Applications
Even though XCOPY deployment is very easy to use, it does not lend itself well to all deployment requirements. For example, if your application has more robust setup and deployment requirements, Visual Studio .NET Installer is a better option. Because Visual Studio .NET Installer is built on top of Windows Installer technology, it takes advantage of Windows Installer's features. To learn about Visual Studio .NET Installer, look first at the architecture of Windows Installer.
Windows Installer Architecture
Windows Installer is a software installation and configuration service that ships with the Windows 2000 and Windows XP operating systems. It also is freely available to all Win9x and NT4 platforms. Windows Installer Service maintains a record of information about every application that it installs. The Windows Installer runtime (MSI) inspects these records during the execution of deployment packages. When you uninstall an application, Windows Installer checks the records to make sure that no other applications rely on its components before removing it.
- Product—A product is something a user can install. For example, MS Word is a product.
- Feature—A feature is the smallest unit of functionality in a product. A product is composed of multiple features. For example, the AutoCorrect functionality can be considered a feature of MS Word.
- Component—A component is the smallest unit that multiple features can share. A component in Windows Installer terms is not the same as a component in the .NET Framework. A Windows Installer component can be a single file or multiple files that logically belong together. It can be an executable, a DLL, or a simple text file. A collection of components can join together to provide a feature, and a component also can be shared across multiple features. Whereas features are specific to a product and identified by a name unique only within the product, components are global across all products installed on a machine. For example, the spell checker component of MS Word can be shared across all the applications that want to implement spell-checking.
Information related to a product, such as features and components, are described in a centralized repository known as the Installation Database. The Installation Database is nothing but a file with the extension .msi that not only contains information about the features and components of the product but also about the sequence of user interfaces displayed during the installation of the product. Because the Windows Installer is registered as the default application for files with an .msi extension, the shell automatically invokes it when a user opens an .msi file. When invoked in this way, the installer reads product information from the Installation Database file and determines whether the product is already installed. If the product is not yet installed, it launches the product's installation sequence, which is described in the database. If the product is installed, different logic is invoked, such as adding and removing features or uninstalling the product.
Additional Visual Studio .NET Features
In addition to the Windows Installer, the deployment projects in Visual Studio .NET also provide the following features:
- Reading or writing of Registry keys
- Enables creating directories in the Windows file system
- Provides a mechanism to register both COM components and .NET components (in the GAC)
- Gathers information from the users during installation
- Enables setting launch conditions, such as checking the user name, computer name, current operating system, software application installed, presence of .NET CLR, and so forth
- Enables running a custom setup program or script after installation
You will take an in-depth look at all the above-mentioned features when you create deployment projects using Visual Studio .NET in an upcoming section of this article.
Page 2 of 5