HOW TO: Deploy COM Interop Programs to Internet Explorer (311297)
The information in this article applies to:
- Microsoft .NET Framework SDK 1.0
- Microsoft Internet Explorer (Programming) 5.5
- Microsoft Internet Explorer (Programming) 6.0
This article was previously published under Q311297 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.
- Create a .cab file to deploy the COM component.
- 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.
- 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>
- 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.
Modification Type: | Major | Last Reviewed: | 6/22/2006 |
---|
Keywords: | kbCOMInterop kbCtrl kbHOWTOmaster KB311297 kbAudDeveloper |
---|
|