Can a WiX Custom action return a string other than the custom action status #6559
-
In our wix installer, we have a custom action and it might fail due to more than one reasons. We want to inform the user with specific error message corresponding to the failure. But the custom action returns a single error status at the end which becomes very generic for us to display the exact error message. Did someone encounter this and had a solution? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
This would probably be better in the discussions area. But if you're using the C++ CustomAction template that comes with the VS extension then there's a macro for showing error messages. example In this case the code asks the user whether to continue or not. do
{
hr = ::CoCreateInstance(CLSID_MSAdminBase, NULL, CLSCTX_ALL, IID_IMSAdminBase, (void**)&piMetabase);
if (FAILED(hr))
{
WcaLog(LOGMSG_STANDARD, "failed to get IID_IMSAdminBase Object");
er = WcaErrorMessage(msierrIISCannotConnect, hr, INSTALLMESSAGE_ERROR | MB_ABORTRETRYIGNORE, 0);
switch (er)
{
case IDABORT:
ExitFunction(); // bail with the error result from the CoCreate to kick off a rollback
case IDRETRY:
hr = S_FALSE; // hit me, baby, one more time
break;
case IDIGNORE:
__fallthrough;
default:
WcaLog(LOGMSG_STANDARD, "ignoring absent IIS");
// We need to write the empty script to communicate to other deferred CA that there is noting to do.
hr = ScaWriteConfigurationScript(pwzScriptKey);
ExitOnFailure(hr, "failed to schedule metabase configuration");
ExitFunction1(hr = S_OK); // pretend everything is okay
break;
}
}
} while (S_FALSE == hr); |
Beta Was this translation helpful? Give feedback.
-
Thanks for your response! |
Beta Was this translation helpful? Give feedback.
-
WiX doesn't use issues for support. We moved this issue to the experimental GitHub discussions area. You might also consider asking your question on the wix-users mailing list or posting on Stack Overflow. |
Beta Was this translation helpful? Give feedback.
-
Custom actions don't return values like that but take a look at the session parameter. If you want to display a message or log information, consider looking at If you want to store information for later use, consider setting a property: |
Beta Was this translation helpful? Give feedback.
Custom actions don't return values like that but take a look at the session parameter. If you want to display a message or log information, consider looking at
session.Message
orsession.Log
If you want to store information for later use, consider setting a property:
session["PROPERTY_NAME"] = "PROPERTY VALUE"