Microsoft KB Archive/311297

= HOW TO: Deploy COM Interop Programs to Internet Explorer =

Article ID: 311297

Article Last Modified on 8/28/2007

-

APPLIES TO


 * Microsoft .NET Framework Software Development Kit 1.0 Service Pack 2
 * Microsoft Internet Explorer 5.5
 * Microsoft Internet Explorer (Programming) 6.0

-



This article was previously published under Q311297



IN THIS TASK
SUMMARY
 * Requirements
 * Components That Are Required by the COM Interop Program
 * Limitations of .NET Components Deployment
 * To Deploy a COM Interop Program

REFERENCES



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
 Use Visual Studio 6.0 to create a COM component that will be referenced in your .NET project. 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 Install the COM .dll or .exe file on your development computer. 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. Make sure that the COM-derived assembly is located in the same folder as the other project files. Develop your project. Compile your project.</li> Create a .cab file to deploy the COM component.</li> 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.</li>  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 &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;> <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=&quot;CLSID:D3BEF9B9-F7B5-4C24-B247-32257F37FDB6&quot; CODEBASE=&quot;COM.CAB#version=1,0,0,0&quot;> </OBJECT> <OBJECT id=&quot;ctrl&quot; classid=&quot;YourDllName.dll#NameSpace.YourWindowControl&quot;> </OBJECT>

</BODY> </HTML> </li> 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.</li></ol>

<div class="references_section">