title: WiX install error 2762 while invoking a CustomAction from dialog
body: <p>I am a beginner, started learning WiX. I want to capture and validate and register user details during the installation process. I have created a dialog to capture user registration and invoking a custom action once user clicks on 'Next'.</p>
  
  <p>But here I am getting installer error 2762. Though the error description says that "The action must be scheduled between InstallInitialize and InstallFinalize", I am not able to figure out how to resolve this problem.</p>
  
  <p>Here is my XML script:</p>
  
  <pre><code>&lt;Binary Id="mycustom"
          SourceFile="..\CustomAction1\bin\Debug\CustomAction1.CA.dll" /&gt;
  
  &lt;CustomAction Id="myCustomValidate"
                BinaryKey="mycustom"
                DllEntry="ValidateCustomAction"
                Execute="deferred"
                Return="check"&gt;
  &lt;/CustomAction&gt;
  
  &lt;UI&gt;
      &lt;UIRef Id="WixUI_Mondo" /&gt;
      &lt;Dialog Id="UserRegistrationDlg"
              Width="370"
              Height="270"
              Title="[ProductName] [Setup]"
              NoMinimize="yes"&gt;
          ..
          ..
          ..
          &lt;Control Id="Next"
                   Type="PushButton"
                   X="236"
                   Y="243"
                   Width="56"
                   Height="17"
                   Default="yes"
                   Text="[ButtonText_Next]"&gt;
              &lt;Publish Event="ValidateProductID" Value="0"&gt;1&lt;/Publish&gt;
              &lt;Publish Event="DoAction" Value="myCustomValidate"&gt;1&lt;/Publish&gt;
              &lt;Publish Event="SpawnDialog" Value="InvalidRegDlg"&gt;PIDACCEPTED = "0"&lt;/Publish&gt;
              &lt;Publish Event="NewDialog" Value="SetupTypeDlg"&gt;ProductID AND PIDACCEPTED = "1"&lt;/Publish&gt;
          &lt;/Control&gt;
      &lt;/Dialog&gt;
  &lt;/UI&gt;
  </code></pre>
  
  <p>Following is the custom action code I used.</p>
  
  <pre><code>[CustomAction]
  public static ActionResult ValidateCustomAction(Session session)
  {
      return ActionResult.Success;
  }
  </code></pre>
  
  <p>Custom action is working fine if used in "InstallExecuteSequence". I am not able to figure out the problem, I removed the custom dialog and used the following simple call to invoke custom action. But I ended up with the same error.</p>
  
  <pre><code>&lt;Publish Dialog="LicenseAgreementDlg"
           Control="Next"
           Event="DoAction"
           Value="myCustomValidate"&gt;1&lt;/Publish&gt;
  </code></pre>
  
  <p>I am sure I am doing something silly here, but couldn't figure out. What is the solution?</p>