3

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?

quetzalcoatl
  • 32,194
  • 8
  • 68
  • 107
Tim Long
  • 13,508
  • 19
  • 79
  • 147
  • This is a new question with many details of the original question lacking: http://stackoverflow.com/questions/3901428/wix-register-assemblies-for-com-interop Not so sure how you hope it to generate a better answer. – Hans Passant Oct 10 '10 at 23:58
  • I don't want a better answer, I want AN answer. I'm asking how to call out to managed code from a Wix install - because a third party framework requires this. I don't yet have an answer to that, but there MUST be a way to do it. I omitted many of the original details because my understanding is improving with time and I felt that the original problem needed to be restated with a narrower objective. – Tim Long Oct 11 '10 at 01:50
  • If you can get the ProgID in earlier installation steps and store it as a property, then you can create Custom Action and before actually calling the needed methods get this ProgID just the same way as any WIX property is obtained. – 26071986 Oct 17 '10 at 13:36
  • It's a shame that @christopher-painter deleted his answer to this question because it definitely formed a step along my long journey with WiX and MSI. Perhaps Chris would consider reinstating it? – Tim Long Mar 22 '20 at 17:27

2 Answers2

2

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.

Rob McCready
  • 1,909
  • 1
  • 19
  • 20
  • Thanks for your answer Rob. My question was posted 8 months ago and just a couple of days back I came up with a solution very close to what you propose, which is working well. My custom action actually gets all of its information by reflecting on custom attributes in my installed assemblies, so I didn't need to set any properties in the end. It's a shame that the Windows Deployment team seem to have their head in the sand when it comes to .NET, their strategic direction seems to ignore the changing world around them. – Tim Long May 06 '11 at 15:21
  • 1
    MSI still has to support all windows systems so it really can't take a dependency on .net. I don't think anyone writes direct MSI anyways so the .NET support from the toolkits like WiX/DTF make a huge difference. – Rob McCready May 07 '11 at 00:47
-1

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" />
ketan
  • 19,129
  • 42
  • 60
  • 98
Sunil Agarwal
  • 4,097
  • 5
  • 44
  • 80