问题描述
我正在迁移一些现有产品以使用WiX 3.5(我正在使用Votive VS集成).我要安装的某些项目需要在第三方框架中注册.要求是我必须在第三方.NET程序集中调用Register()方法,以将要安装的项目的存在通知给它.它需要一个COM ProgID.
I'm migrating some existing products to use WiX 3.5 (I'm using the Votive VS integration). Some of the items I'm installing need to be registered with a third-party framework. The requirement is that I must call a Register() method in a third party .NET assembly to inform it of the presence of the items I'm installing. It expects a COM ProgID.
我不知道如何让WiX做到这一点.我曾考虑过创建一个二进制自定义操作",但是找不到将参数(包含ProgID的字符串)传递到该自定义操作中的方法.我不想对其进行硬编码,因为我需要它是可重用的代码.我看不到声明式执行此操作的方法,因为Register()函数是一个黑匣子".
I can't figure out how to get WiX to do this. I thought about creating a binary Custom Action, but I can't find a way of passing a parameter (a string containing the ProgID) into that custom action. I don't want to hard-code it because I need this to be re-usable code. I can't see a way to do this declaratively because the Register() function is a 'black box'.
这是一条陡峭的学习曲线.我最好的方法是什么?
Man this is a steep learning curve. What's my best approach here?
推荐答案
查看WIX的部署工具基金会(DTF). WIX安装中有一个DTF.chm文件,其中包含很多信息.
Look at the Deployment Tools Foundation (DTF) for WIX. There is a DTF.chm file with the WIX installation with lots of information.
假设您的安装过程类似于
Assuming you installation process is something like
- 设置安装,输入参数/ProgID,进行验证等
- 开始实际安装文件
- 呼叫注册方法
您将需要两个自定义操作(忽略回滚和卸载)
You'll need two Custom actions (ignoring rollback and uninstallation)
- SetupRegistration
- DoRegistration
SetupRegistration应该是从UI或在设置阶段后期触发的立即自定义操作.它获取ProgID和所需的任何其他数据,使用CustomActionData对象,并将其分配给名为"DoRegistration"的属性(重要,该属性名称必须与第二个自定义操作相同)
SetupRegistration should be an immediate custom action fired either from the UI or late in the setup phase. It grabs the ProgID and any other data needed, uses a CustomActionData object and assigns that to a property named "DoRegistration" (Important, the property name must be the same as the second custom action)
DoRegistration是一个延迟的自定义操作,可能需要在InstallFiles之后在InstallExecuteSequence中进行调度,但这要视情况而定.它提取Session.CustomActionData属性并获取ProgID,然后调用所需的任何注册方法.
The DoRegistration is a deferred custom action and needs to be scheduled in the InstallExecuteSequence probably after InstallFiles, but that depends. It pulls the Session.CustomActionData property and gets the ProgID out, then calls whatever registration method you need.
这篇关于在安装过程中,如何让WiX调用.NET程序集中的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!