There really isn't anything "simple" about CustomActions that modify the 
machine state.  It is recommended to write a data driven "immediate" (or 
scheduling) CustomAction that reads one or more tables and schedules 
(::MsiDoAction()) the appropriate rollback/install/uninstall/repair(if repair 
is special) actions.  I suppose if you write a single CustomAction + 
SetProperty for each of those steps it would get as complicated as someone 
described.

The WiX extension just provide the ability to extend the WiX language to 
provide a nice way to get data into the tables for the CustomActions.

Fundamentally, just don't assume the task is easy.  Remember you're talking 
about writing something that participates in a compensating transaction.  
Nothing simple about that.

That's why I suggest people avoid CustomActions whenever possible.  <smile/>

Have you considered simplifying your application so you don't need to write 
code in a compensating transaction?

-----Original Message-----
From: Grant Husbands [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 30, 2008 09:04
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] Custom Action Complexity (WiX 2)

Is there an easy way to define and use a custom action that handles
files in some way (also handling rollback and uninstall correctly)?

Looking at the current mechanism, it's seems complicated and
error-prone. Note: I got a friend to ask this same question at
stackoverflow <http://tinyurl.com/wixaction>; you don't need to go there
to follow this email and I've included some answers, here.

If I create such a custom action, I want it to be rolled back correctly.
I also want it to uninstall correctly and to have that roll back
correctly. I need to give those parameters and I need to schedule
everything. In all, that leads to 16 elements in the wxs, for what I
perceive to be a single 'action', with a lot of copy and paste and
conditions that seem like magical incantations and many seem to get
wrong (REMOVE<>"ALL").

In answer, it has been suggested that I write a WiX extension for each
such action; I presume that this isn't expected to be a typical use
case, though. Also, writing an extension to WiX just for a custom action
or two would probably be a little extreme.

Another suggestion has been to have an immediate, scheduled action that
then schedules the appropriate (otherwise unscheduled) actions, based on
context, and also sets their parameters. This leads to (I think) only
four to six elements in the wxs, which is an improvement, but also leads
to every such action having common code for setting up parameters,
working out whether things are being installed or uninstalled and
scheduling actions accordingly.

It seems to me that the ideal case would be having only one or two
elements in the wxs, which would include a CustomAction looking
something like this:
<CustomAction Id="AnID" Execute="everywhichway" BinaryKey="MyDLL"
DllEntryDo="DoThing" DllEntryUndo="UndoThing" Value="[MYPROP]"
Return="check"/>

Could that be made to work? Is there an easy answer? Are there any plans
for providing easy answers in WiX 3 or later? Am I just doing it wrong?

I have .NET development experience and may be able to help in
implementing the solution.

Regards,
Grant Husbands.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to