如何使用Windows Installer XML注册COM对象 [英] How can I register a COM-Object with Windows Installer XML

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

问题描述

我有以下问题:在我的WiX设置中,我需要注册一个COM对象。我有一个.tlb文件和一个.dll文件(在我的例子中:XYCommon.dll和一个XYCommon.tlb)
现在我想让设置注册TLB。
如何在Windows Installer XML中执行此操作?

I have got the following Problem: In my WiX Setup I need to register a COM Object. I have got a ".tlb" File and a ".dll" File (in my example: XYCommon.dll and a XYCommon.tlb) Now I want to make the Setup to Register the TLB. How Can I do this in Windows Installer XML ?

我的第一个尝试是使用CustomAction并打开Regasm.exe并注册 - 我不知道如何我可以带Regasm.exe注册XYCommon.tlb

My first try was to work with a CustomAction and Open "Regasm.exe" and Register it - but I dont know how I can bring the Regasm.exe to Register the XYCommon.tlb

任何帮助?感谢

推荐答案

使用名为。它将生成包含必要的注册表项的WiX源,以正确注册(和注销)您的COM对象。

Use the WiX harvester utility called Heat. It will generate the WiX source that contains the necessary registry entries to correctly register (and unregister) your COM objects.

您的COM对象(XYCommon.dll和XYCommon.tlb )经常更改?

Will your COM objects (XYCommon.dll and XYCommon.tlb) change often?

如果没有:,那么只需对这两个文件运行Heat(读取命令行参数并进行实验

If no: then just run Heat on those two files (read up on the command-line parameters and experiment with them to get the desired output), clean them up if necessary, and add them to your project.

如果是

如果你想尝试运行Heat作为Visual Studio预建置事件,这个SO答案应该给你一些指导:在wix中向安装程序添加文件夹而不是文件?

If you want to try to run Heat as a Visual Studio prebuild event, this SO answer should give you some guidance: Add a folder to installer in wix not files?

有时,当你使用Heat,你仍然需要调整,然后生成.wxs文件一点。因此,您可能需要编写一些wrapper实用程序,在文件列表或目录中调用heat,然后根据需要清理输出。

Sometimes when you use Heat you still need to tweak then generated .wxs files a little. Therefore you may want to write some wrapper utility that calls heat on a list of files or a directory, then cleans up the output how you would like. Then you can add the utility to your build process.

在单个文件上使用热的示例


heat.exe文件myFile.dll -gg -g1 -suid -svb6 -out myFile.wxs

heat.exe file myFile.dll -gg -g1 -suid -svb6 -out myFile.wxs

在整个目录上使用热的示例:


heat.exe dir myDirectory -gg -g1 -suid -svb6 -out myDirectory.wxs

heat.exe dir myDirectory -gg -g1 -suid -svb6 -out myDirectory.wxs

我使用的一些参数的细分:

Breakdown of some of the parameters I used:


  • heat.exe:如果可执行文件不在路径中,则必须指定完整路径

  • 文件myFile.dll:指定要对单个文件运行加热myFile.dll

  • dir myDirectory:指定要在目录myDirectory上运行heat

  • gg:为组件生成GUID

  • g1:生成不带花括号的guids

  • suid:文件和组件的ID,而不是使用文件名作为

  • svb6:禁止收集VB6运行时的COM信息。注意:如果要注册使用VB6运行时的COM对象,则需要使用此标志,以便不会覆盖VB6运行时注册表项

  • heat.exe: you'll have to specify the full path to the executable if it's not in your path
  • file myFile.dll: specify that you want to run heat on the single file, myFile.dll
  • dir myDirectory: specify that you want to run heat on the directory, myDirectory
  • gg: generate guids for the components
  • g1: generate guids without the curly braces
  • suid: suppress creating uniquely generated ids for files and components, instead use the file names as the ids
  • svb6: suppress harvesting COM information for the VB6 runtime. Note: If you want to register COM objects that use the VB6 runtime, you need to use this flag so that you do not overwrite your VB6 runtime registry entries

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

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