title: Visual Studio 2010 MSI project and Service Installer Class using Custom Actions
body: <p>Other than this, my installer class is nothing special.  It installs the windows service.  But now I am needing to prompt the user for some info and pass the info to the installer class so that the installer class can update the app.config.</p>
  
  <p>I added three extra pages to the default User Interface: </p>
  
  <ul>
  <li>Textboxes (A)  </li>
  <li>Textboxes (B)  </li>
  <li>Textboxes (C)</li>
  </ul>
  
  <p>Variables:</p>
  
  <ul>
  <li>On A, I am using EDITA1, and the rest are invisible</li>
  <li>On B, I am using EDITB1, and the rest are invisible</li>
  <li>On C, I am using EDITC1, and the rest are invisible</li>
  </ul>
  
  <p>In the "Install" Custom Action, I have the Properties set like this:</p>
  
  <ul>
  <li>Arguments: Blank</li>
  <li>Condition: Blank</li>
  <li>CustomActionData: /MYPARAM1=[EDITA1] /MYPARAM2=[EDITB1] /MYPARAM3=[EDITC1]</li>
  <li>InstallerClass: True</li>
  </ul>
  
  <p>In the installer class, Install is overridden</p>
  
  <pre><code>public override void Install(IDictionary stateSaver)
  {
      base.Install(stateSaver);    
  
      // This is to display the Parameters
      // It comes up blank.  No Parameters.
      System.Text.StringBuilder sb = new System.Text.StringBuilder();
      foreach (string s in Context.Parameters.Keys)
      {
          sb.Append(s);
          sb.Append(":");
          sb.AppendLine(Context.Parameters[s]);
      }
      //throw new InstallException(sb.ToString());
  
      //This returns TRUE.
      //throw new InstallException(Context.Parameters.ContainsKey("MYPARAM1").ToString());
  
      string x= Context.Parameters["MYPARAM1"];
      if (string.IsNullOrEmpty(x))
      {
          throw new InstallException("Missing parameter 'MYPARAM1'");
      }
  
      &lt;snip&gt;
  }
  </code></pre>
  
  <p>When the app runs, MYPARAM1 is empty, so I see the InstallException at the end.</p>
  
  <p>I added two chunks of test code at the top of install.  The first, creates a string with all the params that should have come in on the command line.  I do not get my parameters at all.  The second chunk reports "TRUE" -- meaning that the key "MYPARAM1" was on the command line.  The first and second chunk do not agree.  How can this be?</p>
  
  <p>As an experiment, I tried changing the strings to /MYPARAM1 instead of MYPARAM1.  That did not help.</p>