title: MSBuild - How to build a .NET solution file (in an XML task script) from pre-written command line commands
body: <p>I have been studying MSBuild as I have the need to automate my development shop's builds. I was able to easily write a .BAT file that invokes the VS command prompt and passes my MSBuild commands to it. This works rather well and is kinda nifty. </p>
  
  <p>Here is the contents of my .BAT build file:</p>
  
  <pre><code>call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\vcvars64.bat"
  cd  C:\Sandbox\Solution
  msbuild MyTopSecretApplication.sln /p:OutputPath=c:\TESTMSBUILDOUTPUT /p:Configuration=Release,Platform=x86
  pause
  </code></pre>
  
  <p>^ This works well but I now have the need to use the MSBuild task for TeamCity CI. I have tried to write a few MSBuild scripts but I cannot get them to work the same. What is the equivalent build script to the command I am using in my .BAT file? Any ideas?</p>
  
  <p>I have tried using something like this, but no success (I know this is wrong):</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;project name="Hello Build World" default="run" basedir="."&gt;
  
  &lt;target name="build"&gt;
      &lt;mkdir dir="mybin" /&gt;
      &lt;echo&gt;Made mybin directory!&lt;/echo&gt;
  
    &lt;csc target="exe" output="c:\TESTMSBUILDOUTPUT"&gt;
      &lt;sources&gt;
        &lt;include name="MyTopSecretApplication.sln"/&gt;
      &lt;/sources&gt;
    &lt;/csc&gt;
    &lt;echo&gt;MyTopSecretApplication.exe was built!&lt;/echo&gt;
  &lt;/target&gt;
  
  &lt;target name="clean"&gt;
      &lt;delete dir="mybin" failonerror="false"/&gt;
  &lt;/target&gt;
  
  &lt;target name="run" depends="build"&gt;
    &lt;exec program="mybin\MyTopSecretApplication.exe"/&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>What I simply need is an MSBuild XML build script that compiles a single solution for Release mode to a specified output directory. Any help?</strong></p>