How can I get WiX to call a method in a .NET assembly as part of the installation process?

拜拜、爱过 提交于 2019-12-04 15:43:24

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.

Sunil Agarwal

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" />
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!