title: TreatWarningsAsErrors vs /warnaserror
body: <pre><code>class Program
  {
      static void Main(string[] args)
      {
          int unused = 3;
      }
  }
  </code></pre>
  
  <p>If I add:</p>
  
  <pre><code>&lt;TreatWarningsAsErrors&gt;false&lt;/TreatWarningsAsErrors&gt;
  </code></pre>
  
  <p>To the *.csproj file, then everytime I try to compile this program, the build will fail because the unused variable warning is promoted to an error. This is the same thing as setting the "Treat Warnings as errors" option under "Project > Properties" to "All" in the Visual Studio IDE.</p>
  
  <p>Instead, if I compile like:</p>
  
  <pre><code>msbuild /warnaserror
  </code></pre>
  
  <p>The build will fail the first time, but binaries will still be produced, and therefore, every subsequent build will pass.</p>
  
  <p>Is there a difference msbuild command line arguments and msbuild properties I am not understanding?</p>
  
  <p>Also, I assume the msbuild command line arguments are not simply being passed to csc.exe, because if I do:</p>
  
  <pre><code>csc.exe -warnaserror Program.cs
  </code></pre>
  
  <p>No executable is produced and the build always fails.</p>