| Determining When to Use Windows Installer Versus XCOPY |
Origem do texto: http://msdn.microsoft.com/en-us/library/aa302347.aspx
Martin Wasznicky January 2002 Summary: Examines and compares two approaches for deploying Microsoft .NET applications: the DOS XCOPY command, and the Microsoft Windows Installer technology. (8 printed pages) Objectives
AssumptionsThe following should be true for you to get the most out of this document:
ContentsIntroduction IntroductionThe Microsoft .NET Framework provides several new features poised to make application deployment as simple as an XCOPY operation. Many developers are familiar with the issues of deploying traditional COM applications; registering classes and type libraries, maintaining binary compatibility, and the lack of side-by-side component deployment (all of this is sometimes referred to as "DLL HELL"). Regedt32.exe has become a familiar tool in the developer's component deployment arsenal because of the dependencies that COM has with the registry. With the introduction of assemblies and versioning to the .NET Framework, the umbilical cord to the registry is finally cut. Because assemblies are self-describing (they contain metadata describing, among other things, the types, resources, and referenced assemblies), their dependency on the registry is removed, making the promise of XCOPY deployments a reality. However attractive XCOPY deployment sounds, like any technology, it has its limitations. Depending on the complexity and automation needs of a particular deployment scenario, XCOPY may not be able to live up to an application's deployment needs. In these cases, the .NET Framework integrates with Microsoft Windows Installer 2.0 technology to provide alternative setup, distribution, and deployment options for the developer. Furthermore, Visual Studio .NET provides setup and deployment projects, built on top of the Windows Installer 2.0 technology. This allows developers to easily create setup and deployment packages for the more complex applications built on the .NET Framework. There are two major topics covered in this document:
Using XCOPYDeploying applications usually consists of distributing the final application or component to computers on which the application will run. Due to the self-describing nature of .NET assemblies, deployment and replication of .NET-built applications using XCOPY has become a reality because, in many cases, there is no longer a need to modify the registry or perform other ancillary tasks, like stopping a Microsoft® Windows® NT Service. The simplicity of assemblies makes XCOPY an appropriate tool to use in certain specific deployment scenarios. Some applications that lend themselves very easily to XCOPY deployment and replication are XML Web Services and ASP.NET Web applications. Previously, these types of applications were built using Internet Information Services (IIS) and traditional COM components. Installing the components for these applications usually entailed registering the component during the deployment process by using the Regsvr32.exe utility. Updating existing components was far more troublesome, because IIS placed an exclusive file lock on the components. The only way to release the lock was to shut down IIS. Replacement of existing components typically included the following steps:
These steps are no longer needed for XML Web Services and ASP.NET Web applications. IIS does not place exclusive file locks on .NET assemblies and, because assemblies are self-describing, they don't have to be registered. This makes ASP.NET Web-based applications ideal for XCOPY deployment and management. As an example, let's walk through deploying an XML Web Service to a remote computer located on the same Windows NT domain. For the purposes of this example, the client computer where the Web application currently resides is named CLIENT1, and the remote computer, to which the Web application will be deployed, is named SERVER1. Here is what the directory structure of the Web application to deploy looks like.
Figure 1. Internet Information Service's MMC on CLIENT1 displaying the virtual directory of the DemoWebSrv ASP.NET Web application to deploy to SERVER1 Within the /bin subdirectory, there is an assembly named DemoWebSrv.DLL. The physical location of the directory structure on CLIENT1 is C:\INETPUB\WWWROOT\DEMOWEBSRV. The path, C:\INETPUB\WWWROOT on CLIENT1 is mapped to the network share name of WWWROOT Let's start the deployment scenario by following these steps:
Next, you'll find the explanation of the switches used at the end of the XCOPY command. To view a more complete listing, type XCOPY /? at a DOS command prompt.
That's all there is to it. XCOPY successfully deploys the XML Web Service to SERVER1. XCOPY is ideal for simple deployments like these and for on-the-fly updates. XCOPY is also useful for deploying desktop applications on the client. As with any technology, there are limitations as to how and when you should use XCOPY to deploy .NET-built applications. Typically, XCOPY is only useful in deployment scenarios that are simple and manually executed. Listed below are some cases where XCOPY would not suffice; these would require a more robust deployment method.
Although XCOPY works well for simple solutions, there are obviously many cases where a more robust deployment solution is warranted. Such an option is provided by Visual Studio .NET Installer, which is built on top of the Windows Installer 2.0 technology. Let's look at that next. Windows InstallerOften, application setup requirements are far more complex then those that can be handled by a simple XCOPY deployment strategy. In many cases, the final deployment solution is targeted towards end users who lack the necessary skills to manually configure an application. In other cases, there may be so many configuration requirements (such as the creation of users and groups, configuration of security, creation of directory structures, and so on) that an automated setup program becomes necessary to ensure accuracy and consistency in the final application's installed behavior. In either case, an XCOPY deployment is usually insufficient to meet such requirements. For more robust application and deployment needs, Visual Studio .NET can be used to build setup and deployment packages. Visual Studio .NET deployment is built on top of Windows Installer technology. Windows Installer is a software installation and configuration service that ships with the Microsoft® Windows® 2000 and Windows XP operating systems and is freely distributed 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 an application is uninstalled, the records are checked to make sure that no other applications rely on its components before removing it. Windows Installer 2.0 has been extended to provide the following features to support .NET assemblies:
In addition to these features, Visual Studio .NET deployment projects allows all of the conveniences of other setup programs, like reading and writing registry keys, directory creation, registration of components, collecting user-entered data during installation, and so on. Other included features are:
To illustrate a Visual Studio .NET deployment, let's walk through deploying the XML Web Service that was previously deployed using XCOPY.
What's New in Visual Studio .NET?
SummaryThe self-describing nature of .NET-built assemblies makes it feasible to use XCOPY to deploy and update simple applications. XCOPY can easily handle those deployment scenarios that require manual installations with few dependencies and configuration options. XML Web Services and ASP.NET Web Applications lend themselves particularly well to this type of deployment, especially during the development stage of the application. Visual Studio .NET also provides other deployment tools, based on Windows Installer, that allow more flexible and robust configuration and automation requirements. Using Visual Studio .NET to create Windows Installer programs allows developers to create sophisticated installation programs for the most demanding applications. Which deployment option to use is ultimately determined by the scope and depth of the application's configuration requirements. About the AuthorMarty Wasznicky is a Senior Systems Engineer with Microsoft Corporation, focusing on Enterprise Application Integration, Business to Business, and E-Commerce. He has more than ten years of experience architecting and implementing solutions in the IT industry, in both corporate and consulting capacities. He is a Microsoft Certified Solutions Developer, Microsoft Certified Systems Engineer, Microsoft Certified Database Administrator, and Certified Novell Engineer. He has authored numerous articles in the Visual Basic Programmer's Journal and the Access/VB/SQL Advisor magazines and is currently working in Microsoft's Southern California District. About Informant Communications GroupInformant Communications Group, Inc. (www.informant.com) is a diversified media company focused on the information technology sector. Specializing in software development publications, conferences, catalog publishing and Web sites, ICG was founded in 1990. With offices in the United States and the United Kingdom, ICG has served as a respected media and marketing content integrator, satisfying the burgeoning appetite of IT professionals for quality technical information. |



