Deployment

 
Chapter 8 - Assemblies
bySimon Robinsonet al.
Wrox Press 2002
  

How the assemblies should be packaged and distributed depends on the application type. Windows Forms applications should be packaged in a Windows Installer Package and distributed using the Windows Installer. Controls inside web pages should be packaged in a .cab file or just the DLL. Distribution can be via a code download. See Chapter 16 for more information about controls.

ASP.NET applications should be distributed using xcopy or ftp .

Now we will talk a little more about the deployment of simple DLLs.

Deployment of DLLs

The packaging of DLLs can be achieved in different ways if the assembly exists as just a single DLL, this is sufficient for packaging. By using a cabinet file, multiple DLLs, configuration files, and other dependent files can be put into the single, compressed .cab file. This also benefits downloading speeds, but you have to watch that the cabinet file doesn't get too large because of too many assemblies. A cabinet file can be created by using the Cab Project Wizard of the Setup and Deployment Projects with Visual Studio .NET. Files that should be included with this cabinet can be easily included with the menu Project Add File .

Another useful format for packaging is a Windows Installer Package. Visual Studio .NET supports creating Microsoft Installer Packages with the Setup Wizard and Merge Modules that can be used within Windows Installer Packages with the Merge Module Project .

It can be expected that a DLL will be installed with other applications that need this DLL, but not as a standalone product. So building a merge module would be useful in most cases. A merge module allows the creation of reusable setup modules. A merge module file ( .msm ) is a single package that contains DLLs, registry entries, resource files, and setup logic to install the component. When a Windows Installer Package is built for the distribution of a Windows application, the merge module can be easily included with this installer package. The complete .NET runtime is available as a merge module and so can be included with installation programs.

Creating a Merge Module

A merge module can be easily created within Visual Studio .NET. Of course, InstallShield or Wise for Windows do have a lot more features than the Merge Module Project in Visual Studio, but the Merge Module Project is included within Visual Studio .NET and will solve a lot of installation issues where the "bigger brothers" are not needed.

When selecting Build Deploy Solution with the opened class library project, a message box appears saying that a deployment project must be created. Merge Module Project should be selected. A File System View is opened in Visual Studio .NET; the left pane shows directories where the files can be configured for installation. Three folders are created automatically:

  • The common files folder is used for common files that are shared between applications. With default installations, it points to C:\Program Files\Common Files . This folder can be used for shared assemblies that are not installed in the global assembly cache. For such assemblies the < codeBase > configuration is needed as we have seen earlier.

  • Assemblies put into the global assembly cache folder will be installed in the global assembly cache during installation.

  • The module retargetable folder is mostly used for merge modules. The merge module will be used from an MSI Package. The MSI package can then define in which directories the files of the retargetable folder should be installed.

We can also add special folders like the Program Files folder, the user 's desktop folder, etc.

Selecting the Module Retargetable Folder using the context menu Add Project Output we see this dialog:

click to expand

Now it's just necessary to select the Primary output, which includes DLL and EXE files, and (if available) Localized resources that include the satellite assemblies. All the referenced assemblies are automatically included in the merge module. This merge module can now be used within Windows Installer packages for other applications.

  


Professional C#. 2nd Edition
Performance Consulting: A Practical Guide for HR and Learning Professionals
ISBN: 1576754359
EAN: 2147483647
Year: 2002
Pages: 244

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net