title: WiX Setup launching same custom action in silent and "normal" mode
body: <p>I need to create a setup to launch a custom action which configures some SQL stuff. </p>
  
  <p>This is my sequence:</p>
  
  <pre><code>&lt;InstallExecuteSequence&gt;
    &lt;Custom Action='StartCustomAction' After='InstallFinalize'&gt;NOT Installed&lt;/Custom&gt;
  &lt;/InstallExecuteSequence&gt;
  </code></pre>
  
  <p>Here i call my custom action:</p>
  
  <pre><code>&lt;Fragment&gt;
    &lt;Binary Id="CustomActionBinary" SourceFile="$(var.InfPro.dotigaRuntimeSetup.CustomActions.TargetDir)$(var.InfPro.dotigaRuntimeSetup.CustomActions.TargetName).CA.dll"/&gt;
    &lt;CustomAction Id="StartCustomAction" BinaryKey="CustomActionBinary" DllEntry="ShowInitialForm" Execute="immediate" Return="check"/&gt;
  &lt;/Fragment&gt;
  </code></pre>
  
  <p>This is my custom action:</p>
  
  <pre><code>[CustomAction]
  public static ActionResult ShowInitialForm(Session session)
  {
  
     int i = Convert.ToInt32(session["UILevel"]);
     if (i == 2)
     {
         StreamWriter file = new StreamWriter("c:\test.txt");
         file.WriteLine("Test");
  
         file.Close();
          }
     else { 
         InitialForm f = new InitialForm();
         if (f.ShowDialog() == DialogResult.Cancel)
            return ActionResult.UserExit;
         }
         return ActionResult.Success; 
  }
  </code></pre>
  
  <p>The important section is the if-block. For testing purposes i want to create a file and write "Test" in it when the installer is silently executed. 
  According to Microsoft the UILevel property should be 2. <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa372096(v=vs.85).aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/windows/desktop/aa372096(v=vs.85).aspx</a></p>
  
  <p>Unfortunately NOTHING happens. I don't even know if the custom action gets called.</p>
  
  <p>I visited <a href="http://wixtoolset.org/documentation/manual/v3/customactions/qtexec.html" rel="nofollow">http://wixtoolset.org/documentation/manual/v3/customactions/qtexec.html</a> and saw that you can use DllEntry="WixSilentExec" in the custom action tag but as far as i know the DLL entry is the name of your custom action method. In my case ShowInitialForm.</p>
  
  <p>Thanks for your help. ;)</p>