title: Invoking Obfuscar in post build step
body: <p>I'm working on a C# WPF project and I need some obfuscation. I found Obfuscar and it looks very promising, using nuget and a post-build event seems like a solid solution. So I've installed the nuget package and added and tweaked the obfuscar.xml file in such a way that it should work.</p>
  
  <p>However, the post build command refers to the macro <code>$(Obfuscar)</code>, which is not recognized. Now when I build my project, I get the following build error:</p>
  
  <blockquote>
    <p>The command " obfuscar.xml" exited with code 9009.</p>
  </blockquote>
  
  <p>Please note the empty space after the first quotation marks: <code>$(Obfuscar)</code> can obviously not be resolved somehow.
  I tried all steps described by the docs and on other websites, including putting the macro inside quotation marks, but I just can't get it to work.</p>
  
  <p><strong>-- edit --</strong></p>
  
  <p>What I've done:
  - installed the Obfuscar nuget
  - added obfuscar.xml file with basic configuration
  - added post-build event
  - try to build</p>
  
  <p>What I've tried in terms of post-build events:</p>
  
  <p><code>$(Obfuscar) obfuscar.xml</code></p>
  
  <blockquote>
    <p>The command " obfuscar.xml" exited with code 9009.</p>
  </blockquote>
  
  <p><code>"$(Obfuscar)" obfuscar.xml</code></p>
  
  <blockquote>
    <p>The command """ obfuscar.xml" exited with code 9009.</p>
  </blockquote>
  
  <p>I've tried to build and run the <a href="https://github.com/obfuscar/example" rel="nofollow noreferrer">example project</a> and that works perfectly. I've copy-pasted the post-build event (not the xml file) from the example project to my project but that just gives the same results.</p>
  
  <p>What I don't understand either is how Visual Studio could possibly know what <code>$(Obfuscar)</code> means or how to resolve it to the path of the Obfuscar executable. Do I need some kind of configuration for that somewhere or is it some special kind of black magic that should just work?</p>
  
  <p><strong>-- edit 2 --</strong></p>
  
  <p>I've <em>kind of</em> got it to work now by copying the Obfuscar executable from the nuget folder to a folder in my PATH (C:\Windows for now) as "obfuscar.exe" and simply use the post-build command <code>obfuscar obfuscar.xml</code>. I say <em>kind of</em> because actually using the nuget instead of a copied executable is that now I don't have automatic updates. Now when a new version comes out, I'll have to copy/paste it manually. Guess I'll have to add that to the readme file for now until a better solution comes up.</p>