Skip to content

Conversation

@tdykstra
Copy link
Contributor

Fixes #21173

@jkoritzinsky
Copy link
Member

@AaronRobinsonMSFT in the AnyCPU case will the com host always be 64-bit or will it match the bitness of the SDK running the build?

@AaronRobinsonMSFT
Copy link
Member

@AaronRobinsonMSFT in the AnyCPU case will the com host always be 64-bit or will it match the bitness of the SDK running the build?

it is an SDK setting. The confusion is warranted as the behavior is unfortunate and unexpected. The suggested documentation is very misleading and not appropriate. Let me provide some nuance in review.


Unlike in .NET Framework, there is no support in .NET Core for generating a COM Type Library (TLB) from a .NET Core assembly. The guidance is to either manually write an IDL file or a C/C++ header for the native declarations of the COM interfaces.

In .NET Framework, an "Any CPU" assembly can be consumed by both 32-bit and 64-bit clients. In .NET Core, .NET 5, and later versions, "Any CPU" assemblies are accompanied by 64-bit *.comhost.dll*, so they can only be consumed by 64-bit clients.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In .NET Core, .NET 5, and later versions, "Any CPU" assemblies are accompanied by 64-bit .comhost.dll, so they can only be consumed by 64-bit clients.

Right, that is the default because that is what the SDK represents. This is identical in behavior to how one would publish a "self-contained" feature, by default it uses what the SDK provides. The NETCoreSdkRuntimeIdentifier MSBuild property is key here. That property determines the bitness of *.comhost.dll. The managed part is actually bitness agnostic as expected, but the accompanying native asset defaults to the SDK.

I think that is the nuance needed here.

@tdykstra
Copy link
Contributor Author

Thanks for the review, @IEvangelist !

Copy link
Member

@AaronRobinsonMSFT AaronRobinsonMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@tdykstra tdykstra merged commit 8e342d3 into master Jan 28, 2021
@tdykstra tdykstra deleted the tdykstra-patch-1 branch January 28, 2021 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clarifications about exposing "Any CPU" assemblies to 32-bit COM clients needed

7 participants