Com Interop in .netcore #17327
Com Interop in .netcore #17327
Comments
/cc @yizhang82 |
@acesiddhu COM interop is supported in WIndows only for .NET Core, and it does not have full support (such as IDispatch) as full .NET framework. |
Is there way to Get instance of IUnknown interface? Specifically I am looking to use IMetaDataDispenser interface. |
@acesiddhu You can use Marshal.GetObjectForIUnknown to convert it to a RCW (assuming that's what you mean by "get instance of IUnknown interface", or simply have your p/invoke (if any) returns IMetadataDispenser interface. Just keep in mind it is windows only :) |
@yizhang82 PS: I am writing code which is build against .net core but for now it is currently available on windows hence I am trying to use COM as of today. |
I can also Call CoCreateInstance. Just wanted to check which one is preferred way in .Net core (given that requirement is to run only on Windows :)) |
@acesiddhu Yes, CoCreateInstance should work if you want to create the object:
Personally that's the way I would go, assuming that you need to create the underlying COM object given a GUID, and simply cast that to a ISomeComInterface to make calls. |
@acesiddhu I'm closing this issue for now. Let me know if you have further questions and feel free to re-open this. |
@yizhang82 ` public static void Main(string[] args)
|
@wxb1 My first guess is that you are running .NET Core app under 64-bit (that's the only flavor we support today officially) and your VB6 COM is registered under 32-bit (since it is 32-bit only). The 64-bit/32-bit registry are in different places in registry. |
Thanks yizhang82. .Net core is 64-bit only?! I can't use it for my purposes then... Is there any plans for 32-bit? Is there is a time frame? |
@gkhanna79 can you comment on 32-bit plan? |
We do have .NET Core for Windows x86. The installers/downloads are available at https://www.microsoft.com/net/download#core. |
Is it possible to make a COM server in .NET Core, by using something like Additionally, is it possible to compile this COM-visible assembly to a native Windows dll? (By using CoreRT) |
Hi,
Is COM interop possible in .net core? I am trying to create a instance of an com interface using RunTimeEnvironment.GetRuntimeInterfaceAsObject. Looks like the api is not present.
The text was updated successfully, but these errors were encountered: