COM dll registration is not a valid win32 application

122 Views Asked by At

I'm trying to use COM interop, specifically with .net core and C++. I have a .net core library which I'm trying to expose to a C++ codebase.

  • I've created my own IDL file that declared the interface I wanted
  • Via midl.exe a corresponding .tlb file was created
  • I've registered the comhost.dll with regsvr32 (64 bit client) and as a result, I can see the registration (with the error invalid Win32 application):

enter image description here

However, when I try to create an instance of said COM object, it tells me that it's not a valid win32 application.

Settings used to publish the dll enter image description here

I've also tried creating an instance with New-Object:

$object = New-Object -ComObject GrpcLibrary.KioskProcessor

Which gave me the error saying that it couldn't create an instance of the COM object, error code: 80131513 method doesn't exist (HRESULT 0x80131513)

Environment (running Windows 11 ARM64 VM on Mac M3)

enter image description here

At the moment I'm unsure what I'm doing wrong, and why I cannot create an instance of the COM object. Also tried the solution mentioned here by adding Arm64X in a PropertyGroup in the csproj file.

Update

The cs class where I've provided ComVisble(true) as an annotation:

[ComVisible(true)]
[Guid("9526a66b-200b-4157-aedc-56f084962031")]
[ProgId("GrpcLibrary.KioskProcessor")]
public class KioskProcessor : IKioskProcessor
{
    private readonly GrpcChannel channel;

    public KioskProcessor(string ipAddress = "http://localhost:50051")
    {
        channel = GrpcChannel.ForAddress(ipAddress);
        ....
    }

    ...
0

There are 0 best solutions below