question

Yauheni-1328 avatar image
0 Votes"
Yauheni-1328 asked RLWA32-6355 commented

regsvr32 doesn't register my library as COM without dotnet sdk

I try to register my Library.comhost.dll as COM in registry, but without dotnet sdk I have issue

Result:
119190-image.png


After .net 5 sdk was installed my library was appeared in registry,

Result:
119228-image.png

Also I found out that I don't need all libraries from dotnet folder

The folder hierarchy with dlls which placed inside are enough to successfully registration
119229-image.png

My question: Potentially I don't want to download and install sdk for end consumers. So I need workaround for case without install sdk.

Do we have some workaround for my case or maybe some guesses about what I do wrong?

Please let me know about additional details from my side to help me

dotnet-csharp
image.png (9.0 KiB)
image.png (5.1 KiB)
image.png (11.0 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DanielZhang-MSFT avatar image
0 Votes"
DanielZhang-MSFT answered Yauheni-1328 commented

Hi @Yauheni-1328,
From this document, we can know that the prerequisite is install .NET Core 3.0 SDK or newer version.
And there is no support in .NET Core or .NET 5+ for generating a COM Type Library (TLB) from a .NET assembly.
You can refer to the steps about embedding a type library into your application.
Best Regards,
Daniel Zhang


If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @DanielZhang-MSFT , thank you for the answer!
I have read document mentioned above but it doesn't describe why sdk need for registering comhost.dll in registry.
I mean I didn't find information about regsvr32 utility why this utility doesn't work without sdk.
I guess in the start of document mention about nessessary install sdk before generating comhost.dll and further I see information about registering comhost.dll using regsvr32.
I'm not sure but maybe information about installing sdk related with generating comhost.dll and correct work of regsvr32 utility.
But for me it looks strange because regsvr32 is independent program that comes with windows but not with sdk.
What do you think about it?
Thanks!

0 Votes 0 ·

Hi @Yauheni-1328,
As document said that Self-contained deployments of COM components are not supported. Only framework-dependent deployments of COM components are supported.
By default, in .NET Core, .NET 5 and later, the "Any CPU" assembly comes with 64-bit *.comhost.dll. Therefore, they can only be used by 64-bit clients. This is the default setting, because this is what the SDK represents. That is to say, applications with different versions and different frameworks require different SDKs, so different SDKs can be used to meet different needs when registering with regsvr32.
Best Regards,
Daniel Zhang


0 Votes 0 ·

Thanks a lot!

0 Votes 0 ·
RLWA32-6355 avatar image
0 Votes"
RLWA32-6355 answered RLWA32-6355 commented

Take a look at enablecomhosting-with-self-contained-deployment. It seems similar to this issue.


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks a lot!

0 Votes 0 ·

You're welcome. Was self-contained deployment the problem?

0 Votes 0 ·