cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
millevlada
Level 2

custom actions conditions, how to define and use it?

Hi.
I would like to execute some sequence of custom actions (mostly managed code functions, and few command line executions), but it must depend on returned results from executed functions from previous steps. Also, it should be executed only if some feature is selected in setup type (for example named DBFeature).

For example, some sequence similar as pseudo code:

bool IsInstalled = true;
bool InstallStarted = false;
uint InstallFinished = false;

if (DBFeatureSelected) then
IsInstalled = MyClass.IsSqlInstanceInstalled("MySQLInstanceName");

if (DBFeatureSelected)
{
if (!IsInstalled)
InstallStarted = ExecuteSomeExeFile(EXEFileName, commandParams);
else
ShowMessage("SQL Instance already installed...");
}

if (DBFeatureSelected && !IsInstalled)
{
if (InstallStarted)
InstallFinished = MyClass.DetectSqlInstallationFinished("MySQLInstanceName", 3000);
else
ShowMessage("Error in starting SQL Instance installation...");
}

if (DBFeatureSelected && !IsInstalled && InstallStarted)
{
if (InstallFinished)
DBAdded = MyClass.AddDB("MySQLInstanceName", "MyDBName");
else
ShowMessage("SQL Instance installation timeout...");
}
...

I think it is enough to get the picture... So my questions can be defined as:

1. Where in documentation I can found some decent explanation how to use conditions in setup? I have tried to find it IS user guide.pdf but didn't succeed...
2. How to detect in conditions that some feature is selected (for example feature named DBFeature)?
3. How to define some global variables and get result of managed code function into it? How I can use this variables later in other conditions?
4. In custom action properties there is some UICondition and similar properties, but it is unclear to me how to use this to define some conditions that can be used to resolve sequence that I gave as example.
5. Is there some limitation in project types that must be chosen to enable similar use of custom actions? (this should be only small part of setup that should also involve installation of win service module and few client applications...)

As you can see, I have lot of questions and I would appreciate any help here. But please do not give me some general hints and links to tons of pages of documentation, at least give me some hints where exactly to look for. I would prefer some simple examples if it is possible.

Best regards.
Labels (1)
0 Kudos
(1) Reply
RobertDickau
Flexera Alumni

For a start, you might look at the MSI help topic "Conditional Statement Syntax", and also the examples it links to.
0 Kudos