title: Visual Studio prebuild powershell script exiting with code 9009 and failing to build
body: <p>In my project I have set pre-build event that updates content of *.cs and *.xaml files (which are included in project being built).</p>
  
  <p>I use <code>Set-Content</code> Powershell command for it.</p>
  
  <p>When I test it in Powershell console everything is working perfectly.</p>
  
  <p>But when I paste as in pre-build event it generates error with code 9009 and prevents VS from successfully building my project.</p>
  
  <p>I have set build output verbosity to <code>Diagnostic</code>, but there's no more information on it.</p>
  
  <p>What could be the problem?</p>
  
  <p>My current guess is that VS locks files for building, thus Powershell commands can't modify them.</p>