2 projectname.comhost.dll in same build directory possible?

63 views Asked by At

I have a legacy 32bit-MFC-Application which uses COleDispatchDriver mechanism to use a c# dll made with net7.0 in VSCode.

After build command of c# dll, there is projName.dll , projName.comhost.dll (because i used attributes in *.cs files to make it come visible, and set ItemProperties in *.csproj)

Then projName.comhost.dll was sucessfully registred with regsvr for 32bit dlls.

So the Clsid and pathToComhost dll aswell as the ProgId of the dll are in the registry then.

The MFC-Proj is using a headerfile with a wrapperclass which allows me to "use" this projName.dll

So this is working, no problem with that.

But, now i have a new Testcase which does not work and i don't understand why.

TestCase:

Proj1: Test1c#.dll ComVisible

Proj2: Test2c#.dll ComVisible

Proj1: has <ProjectReference Include="..\Test2c#\Test2c#.csproj" />

then i do the build:

dotnet publish $pathTo*Test1c#*Csproj -c Release -r win-x86 --no-self-contained /p:DebugType=None /p:DebugSymbols=false

Result:

The build directory contains Test1c#.comhost.dll and Test2c#.comhost.dll.

As before i go on and use regsvr to register, Test1c#.comhost.dll this works,

but when using regsvr with Test2c#.comhost.dll it fails with error 0x80008093. (message was: loading comhost dll was possible but call to DllRegisterServer failed)

Now im stuck and trying to understand what happens.

Then i copied Test2c#.runtimeconfig.json

from the builddirectory of the Test2 project into the publish directory of Test1c#.dll to see if regsvr can now successfully call its DllRegisterServer.

Result: success, no error message.

But calling to

bResult = objTestclass.CreateDispatch(L"Test2c#.Test");

in the mfc application fails aswell. (Test1c#dll is still working)

Any hints on that? Is this even a supported scenario?

0

There are 0 answers