title: How to Suppress Warnings for Delphi 2009 Projects using MSBuild
body: <p>I managed to create a .bat for building my Delphi 2009 projects with MSBuild like this:</p>
  
  <pre><code>@SET BDS=C:\Program Files (x86)\CodeGear\RAD Studio\6.0
  @SET BDSCOMMONDIR=C:\Users\Public\Documents\RAD Studio\6.0
  @SET FrameworkDir=C:\Windows\Microsoft.NET\Framework\v2.0.50727
  @SET FrameworkVersion=v2.0.50727
  @SET FrameworkSDKDir=
  @SET PATH=%FrameworkDir%;%FrameworkSDKDir%;%PATH%
  
  msbuild "C:\MyProject.dproj" /t:build /p:config="Release";DCC_ExeOutput="C:\output\bin" &gt; MyProject.log
  </code></pre>
  
  <p>Now I want to suppress warnings and retrieve only errors, if there are any. I tried theses approaches:</p>
  
  <pre><code>msbuild "C:\MyProject.dproj" /t:build /clp:ErrorsOnly /p:config="Release";DCC_ExeOutput="C:\output\bin" &gt; MyProject.log
  msbuild "C:\MyProject.dproj" /t:build /p:WarningLevel=0;config="Release";DCC_ExeOutput="C:\output\bin" &gt; MyProject.log
  </code></pre>
  
  <p>But they still print warnings. So I found this <a href="https://msdn.microsoft.com/en-us/library/ms171470(v=vs.110).aspx" rel="nofollow noreferrer">MSDN Article</a> where they explain how to attach a logger to the build process, and they give this example:</p>
  
  <pre><code>msbuild MyProject.proj /t:go /fileLogger
  </code></pre>
  
  <p>Since this option is for logging, I removed the <code>&gt; MyProject.log</code>.
  I tried in my project like below:</p>
  
  <pre><code>msbuild "C:\MyProject.dproj" /t:go /fileLogger /p:config="Release";DCC_ExeOutput="C:\Output\bin"
  msbuild "C:\MyProject.dproj" /t:go /fileLogger
  msbuild /t:go /fileLogger "C:\MyProject.dproj"
  </code></pre>
  
  <p>I receive this output for both (it's in portuguese, but it means <strong>Unknown option</strong> for /fileLogger):</p>
  
  <p><a href="https://puu.sh/mdD3x/479b8f06db.png" rel="nofollow noreferrer"><img src="https://puu.sh/mdD3x/479b8f06db.png" alt="Image"></a></p>
  
  <p>May this error occurs due to my MSBuild.exe version? (I also have Visual Studio 2012 Professional installed).</p>
  
  <p>The only way I could suppress warnings, was to change the build configuration for the project within Delphi 2009 IDE:</p>
  
  <p><a href="https://puu.sh/mdDow/ee1c6e3c1e.png" rel="nofollow noreferrer"><img src="https://puu.sh/mdDow/ee1c6e3c1e.png" alt="enter image description here"></a></p>
  
  <p>But I didn't want to change this for every project (there are hundreds).</p>
  
  <p>Is there any other way to suppress warnings with MSBuild?
  Or is there any way to change the Release config for all projects, changing <em>Output Warnings</em> to false (like I did within IDE)?</p>