If it isn't a validation issue, make your C# CA run as immediate in the
execute sequence (not the UI sequence) sometime before the RemoveRegistry
standard action and populate the Registry table with new temporary rows for
each of the registry entries it needs to generate. If you feed it the same
properties each time the MSI runs, it will repair the registry values when
appropriate and even remove them when you uninstall the component you tag
them with. Make sure that the component you use has a key path of the
correct category (per-user/profile or per-machine) for the key you place
your registry entries into.

This would then be an implementation of
http://www.joyofsetup.com/2007/07/01/semi-custom-actions/

-----Original Message-----
From: Pound, Robert (CDC/OCOO/ITSO) (CTR) [mailto:u...@cdc.gov] 
Sent: Wednesday, November 24, 2010 10:34 AM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] C# Custom Action - Getting Properties when called from
Publish Event="DoAction"



I am building a C# Custom Action that will be called from dialog button
"Publish".  The C# CA is working when called from the Publish
Event="DoAction".  However, I can not get it to access the properties that
have been set on the dialog page that the push button control is on.  After
researching I saw how to use another CustomAction to set the properties that
can be accessed by the C# DLL.  I was not able to get the C# DLL (called
from Publish) to get the properties using this process.  To test that my
code was working I commented out the Publish Event="DoAction", and modified
the "InstallExecuteSequence" to call the C# CA DLL by. I had to change the
CustomAction for the DLL from "Execute='immediate'" to 'Execute="deferred"'.
The C# CA DLL was able to correctly pick up the properties when I did this.
I then commented out the "InstallExecuteSequence" and uncommented the
'Publish Event="DoAction"', this caused mye to get errors during the
install.  I then changed the CustomAction for the DLL from
'Execute="deferred"' back to "Execute='immediate'". This fixed the install
error, but I'm now back at the original problem of not being able to access
the properties when the C# CA DLL is called from the 'Publish
Event="DoAction"'.
Is there a way for a C# CA DLL to access the properties when the CA is
called from a 'Publish Event="DoAction"'?

The reason why I want to do this is that I am taking the values of the
properties, performing some security operations on them and then storing
them into a series of registry entries that are dynamically created by the
C# DLL.  I need to create the new registry entries from the C# DLL, instead
of being scripted in WiX.

Any suggestions and help will be appreciated.

I am using WiX 3.6.1112.0 + VS2010.

Snippets of code:
Control and Publish:

<

Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17"
Default="yes" Disabled="no" Text="!(loc.WixUINext)"

>

<

Publish Property ="CA.PARAMS1" Order ="1"
Value='"[INPUTPROP1],[INPUTPROP2],[INPUTPROP3]"'

/>

<

Publish Property ="CA.PARAMS2" Order ="1" Value='[INPUTPROP4]'

/>

<

Publish Property ="CA.PARAMS3" Order ="1" Value='[INPUTPROP5]'

/>

<

Publish Event="DoAction" Value="ca.PassParameters" Order="2">1</Publish

>

<

Publish Event="DoAction" Value="ca.My_WiXCustomActions.Sec1"
Order="3">1</Publish

>

</

Control>

CUSTOM ACTION FRAGMENT

<Fragment Id="Frag.CustomAction">

    <Binary Id="bin.My_WiXCustomActions" SourceFile =
'My_WiXCustomActions.CA.dll' />

    <CustomAction Id="ca.My_WiXCustomActions.Sec1"

                BinaryKey="bin.My_WiXCustomActions"

                DllEntry="Sec1"

                Execute="immediate"

                Return="check" />

    <CustomAction Id="ca.PassParameters" Return="check"

                Property="ca.My_WiXCustomActions.Sec1"

                Value="[CA.PARAMS1], [CA.PARAMS2], [CA.PARAMS3]" />

</<Fragment>




----------------------------------------------------------------------------
--
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to