title: Replace characters within an msbuild variable
body: <p>I need to replace characters in a variable I am passing to an exec task within msbuild 4. Specifically, I need to replace all occurrences of backslashes <code>\</code> with forward-slashes <code>/</code> in the <code>$(MSBuildProjectDirectory)</code> variable. </p>
  
  <p>eg:</p>
  
  <pre><code>&lt;Target Name="DoStuff"&gt;
      &lt;Exec Command="stuff.exe $(MSBuildProjectDirectoryWithSlashesFixed)/SomeFile.txt" /&gt;
  &lt;/Target&gt;
  </code></pre>
  
  <p>The executable being called is an oracle component that can't deal with slashes in windows format.</p>
  
  <p>I've had a look at <a href="http://msdn.microsoft.com/en-us/library/dd633440.aspx" rel="noreferrer">Property Functions</a>, but as <code>System.String.Replace()</code> is an instance method rather than a static method, it seems it can't be used for my needs.</p>
  
  <p>Any ideas?</p>