作为安装过程的一部分,如何让 WiX 调用 .NET 程序集中的方法?

发布于 2024-09-26 13:17:07 字数 328 浏览 0 评论 0原文

我正在迁移一些现有产品以使用 WiX 3.5(我正在使用 Votive VS 集成)。我正在安装的一些项目需要向第三方框架注册。要求是我必须在第三方 .NET 程序集中调用 Register() 方法来通知它我正在安装的项目是否存在。它需要一个 COM ProgID。

我不知道如何让 WiX 做到这一点。我考虑过创建一个二进制自定义操作,但我找不到将参数(包含 ProgID 的字符串)传递到该自定义操作的方法。我不想对其进行硬编码,因为我需要它成为可重用的代码。我看不到以声明方式执行此操作的方法,因为 Register() 函数是一个“黑匣子”。

伙计,这是一个陡峭的学习曲线。我在这里最好的方法是什么?

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.

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

剧终人散尽 2024-10-03 13:17:07

查看 WIX 的部署工具基础 (DTF)。 WIX 安装中有一个 DTF.chm 文件,其中包含大量信息。

假设您的安装过程类似于

  1. 安装程序安装,输入参数/ProgID,进行验证等。
  2. 开始实际安装文件
  3. 调用注册方法

您将需要两个自定义操作(忽略回滚和卸载)

  • SetupRegistration
  • DoRegistration

SetupRegistration应该是立即自定义操作从 UI 触发或在设置阶段后期触发。它获取 ProgID 和所需的任何其他数据,使用 CustomActionData 对象并将其分配给名为“DoRegistration”的属性(重要,属性名称必须与第二个自定义操作相同

DoRegistration 是延迟的自定义操作,需要在 InstallExecuteSequence 中安排,可能在 InstallFiles 之后,但这取决于情况。它提取 Session.CustomActionData 属性并获取 ProgID,然后调用您需要的任何注册方法。

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

  1. Setup installation, input parameters/ProgID, do validation, etc.
  2. Begin actual installation of files
  3. Call registration methods

You'll need two Custom actions (ignoring rollback and uninstallation)

  • SetupRegistration
  • 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)

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.

朕就是辣么酷 2024-10-03 13:17:07

我正在使用你所描述的一种。

我习惯在需要时调用 CustomAction(events)。就像单击按钮一样,您可以调用一个为您工作的方法。

调用自定义操作,例如:

CONDITION = "1"

或根据特定按钮点击调用自定义操作:

<CustomAction Id="TestConnection" BinaryKey="SetupCustomActions" DllEntry="TestConnection" Execute="immediate" Return="check" />

Am using a sort of what you have described.

I use to call CustomAction(events) when required. Like on clicking button you can call a method which will do work for you.

Calling custom action like:

<Custom Action="ActionName" After="InstallFinalize">CONDITION = "1"</Custom>

Or calling custom action based on specific button click:

<CustomAction Id="TestConnection" BinaryKey="SetupCustomActions" DllEntry="TestConnection" Execute="immediate" Return="check" />
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文