.NET6: registering COM DLL with regsvr32 results in 80040111

Viewed 51

I'm playing around with CredentialProviders for Win10/11, following Steve Syfuh's blog post and repo. Using the repo as is (.net framework 4.6.1) works nicely, but I'd like to do it in .net6.

I've read the docs about COM for .net core and tried to follow, but whatever I do, I get the following error:

The module [myproject].comhost.dll was loaded but the call to DllRegisterServer failed with error code 0x80040111.

My steps were:

  • put [ComVisible(true)] and unique GUIDs to the public classes that should be reachable (namely CredentialProvider, CredentialView, CredentialProviderCredential)
  • edit .csproj file and add <EnableComHosting>True</EnableComHosting>
  • run the midl tool to get credentialprovider.tlb and add it to the .csproj file:
<ItemGroup>
    <ComHostTypeLibrary Include="..\interop\credentialprovider.tlb" Id="1" />
</ItemGroup>
  • elevate the cmd to run regsvr32 [myproject].comhost.dll and get the error above

I've found this question with similar content (but I cannot run it on my machine, and the [myproject].dll is right next to the comhost one), I tried suggestions in Hans Passant's link, but all in vain.

Does anyone has any suggestions as to what could be the issue, please?

I guess I can still do it in .net framework 4.8 (that again works), but I'd like to meddle with it a bit and I'd like to stick to newest version of .net (and also some of the packages I'd like to use don't support framework anymore).

0 Answers
Related