[wix-users] Write and read data from SQL Compact Edition (.sdf)
Elena Aralla
elena.aralla at gmail.com
Thu Jul 19 01:27:57 PDT 2018
Hi,
> Did you use WiX C# custom action?
Yes, I do!
> You should execute it as immediate to be able to set properties with query results.
> However, files are deployed later, at deferred state, so you need to be able to access the sdf file before it is being deployed.
> Can you describe the requirement in finer details?
I’ll try:
Hi have this tags in product.wxs
<CustomAction Id="EMAIL" Property="EMAIL" Value="empty" />
<CustomAction Id="DoCustomAction1" Return="check" Execute="immediate" BinaryKey="CustomAction1.CA.dll" DllEntry="GetAdminEmail" />
<InstallExecuteSequence>
<Custom Action="EMAIL" Before="DoCustomAction1" />
<Custom Action="DoCustomAction1" Before="InstallFinalize" />
</InstallExecuteSequence>
<Condition Message="EMAIL=[EMAIL]">
<![CDATA[Installed OR EMAIL]]>
</Condition>
My custom action simply assign value to EMAIL and write log.
using System.Text;
using System.Windows.Forms;
using Microsoft.Deployment.WindowsInstaller;
namespace CustomAction1
{
public class CustomActions
{
[CustomAction]
public static ActionResult GetAdminEmail(Session session)
{
session.Log("Begin GetAdminEmail");
String EMAIL = session["EMAIL"];
session.Log(String.Format("Admin email = {0}", EMAIL));
EMAIL = "test at company.mail";
session["EMAIL"] = EMAIL;
session.Log(String.Format("Admin email = {0}", EMAIL));
session.Log("End GetAdminEmail");
return ActionResult.Success;
}
}
}
I can see that the value of EMAIL changes in log file, but in condition message it’s empty.
——— log ———
Begin GetAdminEmail
MSI (s) (34!84) [09:56:19:182]: Closing MSIHANDLE (18) of type 790531 for thread 15748
MSI (s) (34!84) [09:56:19:216]: Creating MSIHANDLE (19) of type 790531 for thread 15748
Admin email = empty
MSI (s) (34!84) [09:56:19:218]: Closing MSIHANDLE (19) of type 790531 for thread 15748
MSI (s) (34!84) [09:56:19:219]: PROPERTY CHANGE: Modifying EMAIL property. Its current value is 'empty'. Its new value: 'test at company.mail'.
MSI (s) (34!84) [09:56:19:221]: Creating MSIHANDLE (20) of type 790531 for thread 15748
Admin email = test at company.mail
MSI (s) (34!84) [09:56:19:223]: Closing MSIHANDLE (20) of type 790531 for thread 15748
MSI (s) (34!84) [09:56:19:227]: Creating MSIHANDLE (21) of type 790531 for thread 15748
End GetSysConfigData
——— ———
I probably did not understand how wix works :)
Thank you.
>
> --
> Nir Bar, Independent WiX Expert. Creator of-
> JetBA: WiX WPF Bootstrapper User Interface Framework
> JetBA++: WiX Native Bootstrapper User Interface Framework
> JetRummikub: Install WiX packages on remote machines
>
>
More information about the wix-users
mailing list