Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

HOW TO: Deploy COM Interop Programs to Internet Explorer


View products that this article applies to.

Summary

This article describes how to deploy COM Interop programs to Microsoft Internet Explorer. COM objects have been fundamental to Microsoft Windows programming for many years. Until .NET platform programs replace those that were developed with COM, developers can use or create COM objects with Microsoft Visual Studio .NET.

Typically, a COM Interop program includes a .NET platform client assembly, one or more metadata assemblies that represent distinct COM type libraries, and one or more registered COM components. Visual Studio .NET includes some templates for deployment projects. You can use CAB projects to create a .cab file to package ActiveX controls that can be downloaded from a Web server to an older Web browser. Developers must make sure that all of the required components are deployed, and must be aware of some limitations in the .NET components deployment.

Requirements

The following list outlines the recommended hardware, software, network infrastructure, and service packs that are required:
  • Microsoft Visual Studio.NET (2002)
  • Microsoft Internet Explorer (Programming) versions 5.5, 6

Components That Are Required by the COM Interop Program

  • The client computer must have the Microsoft .NET runtime installed before you deploy the COM Interop assembly.
  • Developers must deploy all .NET assemblies that are included in the program.
  • Developers must deploy all Interop assemblies that represent distinct COM that are included in the program.
  • All COM components must be deployed and registered on the client computer.

Limitations of .NET Components Deployment

  • Developers cannot install assemblies from the Web directly into the Global Assembly Cache (GAC).
  • You cannot use the OBJECT element to start any already downloaded Windows Forms controls from the GAC.
  • You cannot deploy .NET assembly and COM component in the same .cab file.
  • A single .cab file can only contain one .NET assembly.

To Deploy a COM Interop Program

  1. Use Visual Studio 6.0 to create a COM component that will be referenced in your .NET project.
  2. Create a custom Windows Forms control. Start Visual Studio .NET. On the File menu, click New, and then click Project. Click Windows Control Library in the Visual C# or Visual Basic project types
  3. Install the COM .dll or .exe file on your development computer.
  4. In Solution Explorer, expand the project node, click References, click the COM tab, and then click the COM .dll or .exe file in the Available References box, or browse for the file. Visual Studio .NET generates an Interop assembly that contains the meta data for your COM component.
  5. Make sure that the COM-derived assembly is located in the same folder as the other project files.
  6. Develop your project.
  7. Compile your project.
  8. Create a .cab file to deploy the COM component.
  9. Copy both the .NET program .dll file and the assembly that contains the imported COM types under the same search path on your Web server.
  10. Create a test HTML page that references the .cab file for the COM component and the main .NET assembly file. Because your .NET .dll file depends on the COM component, make sure that the OBJECT tag for your COM component precedes the OBJECT tag for the .NET .dll file.

    This is a sample HTML page:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=iso-8859-1' />
    
    <HTML>
         <HEAD>
              <TITLE>Deployment of COM Interop on Internet Explorer</TITLE>
              
              
         </HEAD>
         
         <BODY>
              <OBJECT CLASSID="CLSID:D3BEF9B9-F7B5-4C24-B247-32257F37FDB6"
              CODEBASE="COM.CAB#version=1,0,0,0">
              </OBJECT>
              
              <OBJECT id="ctrl" classid="YourDllName.dll#NameSpace.YourWindowControl">
              </OBJECT>
              
    
    
              
         </BODY>
    </HTML> 
    					
  11. On any client computer that will use this control, use the CASPol tool to grant FullTrust permissions to the strong name with which the control is signed.

↑ Back to the top


References

For more information, refer to the following Microsoft Web sites:
Code Access Security Policy Tool (Caspol.exe) http://msdn2.microsoft.com/en-us/library/cb6t8dtz(vs.71).aspx

.NET Framework Configuration http://msdn2.microsoft.com/en-us/library/2bc0cxhc(vs.71).aspx.

Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.

For more information about how Internet Component Download works, view the following Microsoft Support WebCast: For more information about hosting secure, lightweight, client-side controls in Internet Explorer, visit the following MSDN Web site: For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
317346 INFO: Native Versus COM-Callable .NET Controls in Internet Explorer

↑ Back to the top


Properties

Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.

↑ Back to the top


Keywords: KB311297, kbhowtomaster, kbctrl, kbcominterop

↑ Back to the top

Article Info
Article ID : 311297
Revision : 7
Created on : 8/28/2007
Published on : 8/28/2007
Exists online : False
Views : 446