使用 WIX 注册 COM EXE [英] Registering COM EXE with WIX

查看:32
本文介绍了使用 WIX 注册 COM EXE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用两个新项目创建了一个解决方案:ATLProject1 是一个 COM dll,而 ATLProject2 是一个 COM EXE.两个项目都用单一方法添加了相同的简单类.

I created a solution with two new projects: ATLProject1 wich is a COM dll and ATLProject2 which is a COM EXE. To both projects added same simple class with single method.

将两者都添加到 WIX 安装项目中(这是一个已经安装了其他 COM dll 的现有安装项目.我只是在本次测试中使用它).

Added both to WIX setup project (this is an existing setup project that already installs other COM dlls. I'm just using it for this test).

在 product.wxs 中添加了以下几行:

Added following lines to product.wxs:

        <Component Id="ATLProject1.dll" Guid="{...}">
          <File Id="ATLProject1.dll" Name="ATLProject1.dll" KeyPath="yes" SelfRegCost="0" Source="$(var.TargetDir)\ATLProject1.dll" />
        </Component>
        <Component Id="ATLProject2.exe" Guid="{...}">
          <File Id="ATLProject2.exe" Name="ATLProject2.exe" KeyPath="yes" SelfRegCost="0" Source="$(var.TargetDir)\ATLProject2.exe" />
        </Component>

还有

  <ComponentRef Id="ATLProject1.dll" />
  <ComponentRef Id="ATLProject2.exe" />

该文件还有以下几行:

<EnsureTable Id="PublishComponent"/>
<EnsureTable Id="Condition"/>
<EnsureTable Id="TypeLib"/>
<EnsureTable Id="Class"/>
<EnsureTable Id="Extension"/>

运行安装程序时出现错误:Module ATLProject2.exe 无法注册.HRESULT -2147024769"(十六进制 0x8007007f 找不到指定的程序).

When running the setup I get error: "Module ATLProject2.exe failed to register. HRESULT -2147024769" (hex 0x8007007f the specified procedure cannot be found).

如果我从设置中删除 ATLProject2,它会成功并且 ATLProject1 在注册表中正确注册(这不会生成注册表信息,例如使用加热,它只是有效).

If I remove ATLProject2 from setup, it succeeds and ATLProject1 is correctly registered in registry (this is without generating registry information e.g. using heat, it just works).

exe 组件应该区别对待吗?

Should exe component be treated differently?

我发现 这篇 10 年前的帖子暗示 heat.exe 不会将 COM exe 视为 COM.如果这是问题,不确定是否仍然如此?

I found this 10 year old post suggesting heat.exe does not treat COM exe as COM. If this is the problem, Not sure if this is still the case?

推荐答案

Windows Installer 不建议使用 SelfReg 在安装时注册.相反,强烈建议将注册添加到您的 .wxs 代码或在构建时捕获注册.

The Windows Installer does not recommend using SelfReg to register at install time. Instead, adding the registration to your .wxs code or capturing the registration at build time is highly recommended.

要手动添加注册,请不要使用 EnsureTable,而是使用 COM 相关元素(如 ClassProgId、<代码>类型库).它可能很乏味,但比在安装过程中尝试自我注册要健壮得多.

To add the registration manually, you don't use EnsureTable, you use the COM related elements (like Class, ProgId, TypeLib). It can be tedious but will be far more robust than trying to selfreg during installation.

不幸的是,在构建期间使用 heat.exe(在 WiX 工具集中提供)捕获注册的替代方法不支持从可执行文件中捕获.如果您对商业解决方案持开放态度,我们 (FireGiant) 开发了一个 heat.exe 的替代方案,可以捕获可执行注册(以及更多).高级收集解决方案在 FireGiant 网站上有更多文档.

Unfortunately, the alternative to capture the registration during build using heat.exe (provided in the WiX toolset) does not support capturing from executables. If you are open to a commercial solution, we (FireGiant) developed an alternative to heat.exe that can capture executable registration (and much more). That advanced harvesting solution has more documentation on the FireGiant site.

这篇关于使用 WIX 注册 COM EXE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆