title: nant: expanding properties in a string
body: <p>Summary:</p>
  
  <p>How do I expand a property with value "download\${bulidmode}\project\setup.msi" to "download\Debug\project\setup.msi" if the property buildmode contained debug so I can use it as the file="" part of &lt; copy ></p>
  
  <p>Detail:</p>
  
  <p>I have a bit of a requirement to be able to expand properties within a string in nant.</p>
  
  <p>For example I have a target that is copying file A to B.  A and B both come from a simple two field CSV file which I'm iterating through using </p>
  
  <pre><code>&lt;foreach item="Line" in="filelist.csv" delim="," property="source.file,target.file"&gt;
  
      &lt;property name="sourcefile" value="${path::combine(source.dir,source)}" /&gt; 
      &lt;property name="targetfile" value="${path::combine(download.dir,destination)}" /&gt;
      &lt;echo message="Copy ${sourcefile} to ${targetfile}" /&gt;
  
      &lt;copy file="${sourcefile" tofile="${destination}" /&gt;
  
  &lt;/foreach&gt;
  </code></pre>
  
  <p>and the filelist.csv will be</p>
  
  <pre><code>build\manifest.xml 
  solutiondirectory\setup-proj-directory\Release\setupproj.msi,ProductA\ProductA.msi
  solutiondirectory\another-proj-dir\Release\setupproj.msi,ProductB\ProductB.msi
  </code></pre>
  
  <p>(The reason we split these out is that we write multi-tiered applications and deploy by MSI to each tier - so one product has multiple msi's all built with the same version numbers)</p>
  
  <p>Anyway - I want to change this to that I no longer have "Release" in the filelist.csv file but something like ${build.mode}.  I would wrap the above code with a</p>
  
  <pre><code>&lt;foreach item="String" in="Release,Debug" delim="," property="build.mode"&gt;
  ....as above
  &lt;/foreach&gt;
  </code></pre>
  
  <p>and the property embedded within the string in the file gets expanded.</p>
  
  <p>I've been beating my head against a brick wall for a few hours, but just can't figure it out.</p>
  
  <p>Thanks</p>