title: How to write setup build date to a property
body: <p><strong>Update 2:</strong> The <a href="http://wixtoolset.org/issues/4213/" rel="nofollow">feature request</a> has been declined, simply because WiX cannot support these "fake" variables cmd.exe offers. So the accepted answer below remains the best solution.</p>
  
  <p><strong>Update:</strong> I have issued a feature request for adding preprocessor dynamic environment variable support. As soon as the devs respond, I'll update this thread.</p>
  
  <hr>
  
  <p><em>Original Question:</em></p>
  
  <p>I want to write the date when the setup has been built to a property.</p>
  
  <pre><code>&lt;Property Name="BuildDate" Value="$(env.Date)" /&gt;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>&lt;Property Name="BuildDate" Value="$(sys.Date)" /&gt;
  </code></pre>
  
  <p>throws CNDL0150: "Undefined preprocessor variable" while</p>
  
  <pre><code>&lt;Property Name="BuildDate" Value="[Date]" /&gt;
  </code></pre>
  
  <p>will of course write the string "[Date]" to the MSI property.</p>
  
  <p>How can I achieve this?</p>
  
  <p>Edit: I've tried "Date" in all cases, same result. Also, adding a new environment variable called "BuildDate" and setting it to "%DATE%" removes the compilation error, but the value written to the MSI doesn't resolve to the actual date, instead it yields the string "%DATE%".</p>