Redistributing MSXML 4.0

 

When you write applications that use MSXML 4.0 SP3, you might also need to redistribute MSXML along with your application. The two ways to redistribute MSXML with your application are:

  • Incorporate msxml4.msi into your application setup.

  • Use the .CAB file (Msxml4.cab) method of distribution for Web download installations

The following sections provide more information on steps you need to follow to use the cab method when deploying and packaging your application.

Redistributing Using a CAB File

The MSXML 4.0 .cab File Redistribution Package makes it possible to distribute MSXML 4.0 through a Web download page, either on the Internet or on a private intranet. To do this, you need to create a Web page that upon opening references the msxml3.cab file. The msxml4.cab file then downloads the MSXML 4.0 DLLs (msxml4.dll, msxml4a.dll, and msxmldr.dll) to the user's system folder and registers MSXML 4.0 on the user's computer.

The following steps describe how to create a Web page that downloads and registers MSXML 4.0 on a user's computer.

To create a Web page that downloads MSXML 4.0

  1. Download msxmlcab.exe to your computer from the MSXML 4.0 download page at the MSDN Download Center at https://msdn.microsoft.com/downloads/.

  2. Run msxmlcab.exe and extract the msxml4.cab file to a folder on your computer.

  3. Copy the msxml4.cab file to a folder in the virtual root of your Web server.

  4. Copy the following HTML code and save it as download-msxml4.htm in the virtual root of your Web server.

    <html>  
    <head>  
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">  
    <title>MSXML 4.0 SP3 Download Sample</title>  
    </head>  
    <body>  
    
    This page downloads MSXML 4.0 SP3...  
    </body>  
    </html>  
    

Note that the object element, in this example, has five attributes. The following table describes these attributes.

Attribute Description
id Identifies the object in the DOM. This attribute is optional.
classid Unique ID that identifies the object. This attribute is mandatory and cannot be changed.
codebase Specifies the path for the msxml4.cab file and the version number. For example, if the msxml4.cab file is located in the Objects folder of the Web site's root directory, the codebase can be changed to:

 codebase="Objects/msxml4.cab#version=4,30,2100,0"

The version number can be changed if you want users to download a different version of MSXML 4.0.
type Specifies the type of object. This attribute cannot be changed.
style Specifies that the object is not displayed on the Web page. This attribute should not be changed.

To test the Web page that downloads and registers MSXML 4.0

  1. If MSXML 4.0 was previously installed on your test computer, delete the following files from your system directory:msxml4.dll, msxml4a.dll, and msxml4r.dll. The MSXML 4.0 DLLs are in the %windir%\system32 directory.

  2. Open Microsoft Internet Explorer and enter the URL of the Web page that you created to download MSXML 4.0 in step 3 of the previous procedure.

    For example, if your Web server is running on the same computer, use the following URL:

    https://localhost/download-msxml4.htm

    Note

    You might need to adjust your browser settings to prevent the download of the.CAB file from being blocked by default Internet Explorer security.

  3. Click Yes in the dialog box that asks if you want to install and run the Microsoft XML Core Services.

  4. Verify that the following files are installed in the %windir%\system32 (32-bit Windows Operating System) or %windir\syswow64 (64-bit Windows Operating System) directory on your computer:

    • msxml4.dll

    • msxml4r.dll