具有独立部署的 EnableComHosting

EnableComHosting with Self-Contained deployment

我有一个 WPF 应用程序,我创建了一个 COM 包装器来公开一些内部功能,这样我们就可以从 Excel VBA 脚本中与它对话。在我尝试安装它之前,它工作得很好。当我使用安装程序发布打包时,我发布为独立的,因此用户不需要安装运行时。如果我这样做,comhost dll 将不会注册。我收到 0x80008083 或 0x80008093 错误。

所以,我认为我的选择是:

  1. 不要使用独立的(不喜欢这个想法)
  2. 单独打包 COM 包装器而不自包含,并保留主应用程序自包含。并非所有用户都会使用此包装器,但必须安装运行时并不好。
  3. 使用另一个 lang/framework 作为包装器?
  4. 也许自包含的时候有注册的方法?

有人有建议吗?

谢谢

这是一个不受支持的场景。在 Exposing .NET Components to COM 中:

Self-contained deployments of COM components are not supported. Only framework-dependent deployments of COM components are supported.

原因在this issue中解释:

This is specifically blocked since success would be very hard to achieve unless there is only a single managed COM server in an application. The reason here is related to potentially having multiple CoreCLR instances in a single process.