I want to show the progress text of my custom action during installation. I implemented the code as in WiX Progress Text for a Custom Action but it doesn't work.
All other text (file copy, for example) is shown, the ActionText table is correctly populated and the ActionText.Action matches CustomAction.Actuib values. Does anyone know what is going wrong? Here is the code:
Main WiX project:
<Product>
<CustomAction Id="MyCA" BinaryKey="MyCALib"
DllEntry="MyCAMethod" Execute="deferred"
Return="check" />
<InstallExecuteSequence>
<Custom Action="MyCA" Before="InstallFinalize" />
</InstallExecuteSequence>
<UI>
<UIRef Id="MyUILibraryUI" />
</UI>
</Product>
UI library:
<Wix ...><Fragment>
<UI Id="MyUILibraryUI">
<ProgressText Action="MyCA">Executing my funny CA...
</ProgressText>
...
<Dialog Id="Dialog_Progress" ...>
<Control Id="Ctrl_ActionText"
Type="Text" ...>
<Subscribe Event="ActionData" Attribute="Text" />
</Control>
...
C# custom action library:
public class MyCALib
{
[CustomAction]
public static ActionResult MyCAMethod(Session session)
{
System.Threading.Thread.Sleep(10000); // to show text
// do something
System.Threading.Thread.Sleep(10000); // to show text
return ActionResult.Success;
}
}
The problem is that you are using "ActionData" but you are not sending a message to the UI with this action data from your custom action.
You must add something like:
public class MyCALib
{
[CustomAction]
public static ActionResult MyCAMethod(Session session)
{
using (Record record = new Record(0))
{
record.SetString(0, "Starting MyCAMethod");
Session.Message(InstallMessage.ActionData, record);
}
System.Threading.Thread.Sleep(10000); // to show text
// do something
System.Threading.Thread.Sleep(10000); // to show text
return ActionResult.Success;
}
}
You can send as many messages as you want from your CA.
If you were using "ActionText" instead it will work but will display the custom action name without additional/custom information.
You will find additional information here:
WiX: dynamically changing the status text during CustomAction
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With