title: wix 3.7 set property based on script/logic/code
body: <p>We have developed a pretty comprehensive wix installer msi package, which includes some 10+ c# custom actions.</p>
  
  <p>My problem is that I have yet to figure out how to programmatically "set" a property.</p>
  
  <p>Basically what I want to do is to parse an existing property into a new property.</p>
  
  <p>This parsing would be nice to do in c#, but could also be done in RegEx, JavaScript or w/e.</p>
  
  <p>However I am unable to do this from my c# custom actions ("Cannot access session details from a non-immediate custom action") and as far as I can read I can only change a property from a type 51 custom action. However a type 51 cannot use my c# custom actions. So its catch 22.</p>
  
  <p>Can anyone give give me an example on how to perform the following in wix:
  Perform a regular expression/string manipulation using the value of one property and setting another with the result.</p>
  
  <p>It seems obvious to me that this should be possible, but after a lot of searching I am still in the dark.</p>
  
  <p>Any help would be appreciated.</p>
  
  <hr>
  
  <p>Edit #1:
  After 3 years of working with wix, I still feel like an amateur, but here goes:
  I thought the only way to send properties and work with them in a custom action was this pattern:</p>
  
  <pre><code> &lt;CustomAction Id="CA.SetCreateMessageQueueProperty"
                    Property="CA.CreateMessageQueue"
                    Value="MsmqData=.\Private$\[MYAPPLICATIONNAME]/ObservationReportingService.svc,Observation delivery queue"
                    Return="check"/&gt;
      &lt;CustomAction Id="CA.CreateMessageQueue" 
                    BinaryKey="BI.CA" 
                    DllEntry="CreateMessageQueue" 
                    Execute="deferred" 
                    Return="check"
                    Impersonate="no"/&gt;
      &lt;InstallExecuteSequence&gt;
        &lt;Custom Action="CA.SetCreateMessageQueueProperty"
                After="InstallFiles"/&gt;
        &lt;Custom Action="CA.CreateMessageQueue" After="CA.SetCreateMessageQueueProperty"&gt;
          &lt;![CDATA[((&amp;FE.Afs=3) AND NOT (!FE.Afs=3))]]&gt;
        &lt;/Custom&gt;
      &lt;/InstallExecuteSequence&gt;
  </code></pre>
  
  <hr>
  
  <p>In the custom action c# assembly:</p>
  
  <pre><code>[CustomAction]
          public static ActionResult CreateMessageQueue(Session session)
          {
              return session.DoCustomAction("CreateMessageQueue",
                  () =&gt;
                      {
                          string msmqData = session.ExtractString("MsmqData");
  
                          //create actual message queue
                              }
                          }
                      });
          }
  </code></pre>
  
  <hr>
  
  <pre><code>internal static ActionResult DoCustomAction(this Session session, string name, Action action)
          {
              session.Log("Begin " + name);
              session.Log("session.CustomActionData.Count:" + session.CustomActionData.Count);
              try
              {
                  action.Invoke();
              }
              catch (Exception ex)
              {
                  session.Log(string.Format("Exception: {0}\nInner Exception: {1}", ex, ex.InnerException));
                  return ActionResult.Failure;
              }
              return ActionResult.Success;
          }
  </code></pre>