I am trying to retrieve a variable from WiX during an install. Here is the tests I have tried:
try
{
string reqid = session["REQUESTID"];
TraceLog.LogMessage("CustomAction => ReportUpgradeStatus: Straight Session is valid");
}
catch
{
TraceLog.LogMessage("CustomAction => ReportUpgradeStatus: Straight Session is invalid");
}
try
{
string reqid = session.CustomActionData["REQUESTID"];
TraceLog.LogMessage("CustomAction => ReportUpgradeStatus: CustomActionData is valid");
}
catch
{
TraceLog.LogMessage("CustomAction => ReportUpgradeStatus: CustomActionData is invalid");
}
try
{
string reqid = session.GetProductProperty("REQUESTID");
TraceLog.LogMessage("CustomAction => ReportUpgradeStatus: GetProductProperty is valid");
}
catch
{
TraceLog.LogMessage("CustomAction => ReportUpgradeStatus: GetProductProperty is invalid");
}
I have some xml in Product.wxs as such:
<InstallExecuteSequence>
<Custom Action="SetRequestIdProp" Before="InstallFiles" />
<Custom Action="ReportUpgradeStatusMVACA" After="SetRequestIdProp" />
<ScheduleReboot After="InstallFinalize"/>
</InstallExecuteSequence>
<Fragment>
<Binary Id="CustomActionBinary" SourceFile="..\..\..\Bin\$(var.Configuration)\InstallationCA.CA.dll"/>
<Property Id="REQUESTID" Value="[REQUESTID]" />
<CustomAction Id="SetRequestIdProp" Property="REQUESTID" Value="[REQUESTID]" />
<CustomAction Id="ReportUpgradeStatusMVACA"
BinaryKey="CustomActionBinary"
DllEntry="ReportUpgradeStatusMVA"
Execute="commit"
Return="check" />
</Fragment>
How can I access the RequestID property? I seriously am at a loss here as I everything I try to make that value appear does nothing.
Any advice at all would be welcome.
EDIT: Problem resolved. Here is what I needed to do:
I changed my CustomAction to:
<CustomAction Id="SetRequestIdProp"
Property="ReportUpgradeStatusMVACA"
Value="REQUESTID=[REQUESTID];APPLIANCEID=[APPLIANCEID];SERVICEURL=[SERVICEURL];STATUSDIR=[STATUSDIR];AUTOUPDATE=[AUTOUPDATE]" />
<CustomAction Id="ReportUpgradeStatusMVACA"
BinaryKey="CustomActionBinary"
DllEntry="ReportUpgradeStatusMVA"
Execute="deferred"
Return="check"
HideTarget="no" />
And my InstallExecuteSequence to:
<Custom Action="SetRequestIdProp" Before="ReportUpgradeStatusMVACA" />
<Custom Action="ReportUpgradeStatusMVACA" Before="InstallFinalize" />
I got the info using:
RequestId = Int32.Parse(session.CustomActionData["REQUESTID"]),
ApplianceId = Int32.Parse(session.CustomActionData["APPLIANCEID"]),
ServiceUrl = session.CustomActionData["SERVICEURL"],
Thanks for the help.