dotnet / dotnet/docs

More detail needed on "Expose .NET Core components to COM"

Open
#30,253 3 comments 1 reaction 0 assignees View on GitHub
dotnet-fundamentals/svc
Dominant language
No language data
Stars
4.8k
Forks
6.1k
Avg merge
15h 21m
Merged PRs (30d)
370

Description

The page says:

> Unlike in .NET Framework, there is no support in .NET Core or .NET 5+ for generating a [COM Type Library (TLB)](https://docs.microsoft.com/en-us/windows/win32/midl/com-dcom-and-type-libraries#type-library) from a .NET assembly. The guidance is to either manually write an IDL file or a C/C++ header for the native declarations of the COM interfaces. If you decide to write an IDL file, you can compile it with the Visual C++ SDK's MIDL compiler to produce a TLB.

Great. How do I manually create an IDL file? How would I manually create the C/C++ header file (probably my preference unless there's a good reason not to do it this way). And if I use an IDL file, how do I compile with the MIDL compiler? And once I do that, what do I do with the TLB?

I'm sure all of this is documented elsewhere. COM interop has been around for ages. But without knowing more specifics, particularly in how it relates to .NET Core, this paragraph is frustratingly useless.

It would be great to see a .h file or a .IDL file for the example shown earlier on the page (btw, the class definition, not just the interface would be useful also).

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: e0842844-005f-5004-022d-fce7a82daff8
* Version Independent ID: 88ddeba8-3b31-95f4-26b2-4a12a7313b47
* Content: [Exposing .NET Core components to COM](https://docs.microsoft.com/en-us/dotnet/core/native-interop/expose-components-to-com)
* Content Source: [docs/core/native-interop/expose-components-to-com.md](https://github.com/dotnet/docs/blob/main/docs/core/native-interop/expose-components-to-com.md)
* Product: **dotnet-fundamentals**
* GitHub Login: @jkoritzinsky
* Microsoft Alias: **jekoritz**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.