title: How to set 'env' preprocessor variables in .wixproj file
body: <p>With the wix toolset, environment variables are accessible in the .wxs file via the env preprocessor prefix, such as </p>
  
  <pre><code>$(env.TestEnvVariable)
  </code></pre>
  
  <p>I've configured our build pipeline to set the environment variables I need, and the msi builds fine. However, you can no longer build the .msi locally, because none of the variables are defined in the local development environment.</p>
  
  <p>I'm using the wix extension for visual studio, and I've been trying to update my .wixproj files to set properties like so:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" xmlns:fg="http://www.firegiant.com/schemas/v3/wxs/fgwep.xsd"&gt;
  
    &lt;!-- ... some other bits --&gt;
  
    &lt;PropertyGroup&gt;
      &lt;TestEnvVariable&gt;TestValue&lt;/TestEnvVariable&gt;
    &lt;/PropertyGroup&gt;
  
  &lt;/Project&gt;
  
  </code></pre>
  
  <p>But when I try and build the msi, I get the error</p>
  
  <p><code>Undefined preprocessor variable '$(env.TestEnvVariable)'</code></p>
  
  <p>Additionally, I get the same error when trying to access the variable with the 'var' prefix:</p>
  
  <p><code>Undefined preprocessor variable '$(var.TestEnvVariable)'</code></p>
  
  <p>I understand that you can set 'var' style preprocessor variables using the define constant element</p>
  
  <pre><code>&lt;PropertyGroup&gt;
    &lt;DefineConstants&gt;SomeOtherVariable=someValue&lt;/DefineConstants&gt;
  &lt;/PropertyGroup&gt;
  </code></pre>
  
  <p>But in our hosted pipelines we are setting these variables as environment variables, because that is easily surfaced in what we're using (azure devops). I could convert all those 'env' variables to 'var' via redefining them all, but that seems unnecessarily complicated, and I would like to maintain their distinction as environment variables. My goal is to allow local dev builds to use the same variable structure, just set them conditionally on configuration=Debug or something. </p>
  
  <p>Is there no better way to set 'env' preprocessor variables for local dev other than conditionally running a batch file to <code>set TestEnvVariable=TestValue</code>?</p>