title: How do I run NAnt build then debug when pressing F5 in VS2005
body: <p>We have a number of projects that have NAnt build files that we can run from batch files.  We went this direction so we can tie the builds to subversion hooks and automate running the tests.  However, the output of the NAnt build is significantly different from what is generated by VS when we push F5.</p>
  
  <p>We would like to be able to override the F5 behavior to do the following:</p>
  
  <ul>
  <li>Run the NAnt Script to build the project and dependencies (the build file is a debug configuration).</li>
  <li>Start the project from the target directory in debug mode so breakpoints can be hit.</li>
  </ul>
  
  <p>Here is a sample of one of our build files:</p>
  
  <pre><code>&lt;?xml version='1.0' ?&gt;
  &lt;project name='DWS.WI.Data.Common' default='all' xmlns='http://nant.sf.net/schemas/nant.xsd'&gt;
      &lt;property name='dbuild.dir' value='build\debug' /&gt;
      &lt;property name='nant.settings.currentframework' value='net-2.0' /&gt;
      &lt;property name='debug' value='true' /&gt;
  
      &lt;!-- User targets --&gt;
      &lt;target name='all' /&gt;
      &lt;target name='cleandeb' description='remove previous debug build files'&gt;
          &lt;delete dir='${dbuild.dir}' if='${directory::exists(dbuild.dir)}' /&gt;
      &lt;/target&gt;
      &lt;target name='init'&gt;
          &lt;mkdir dir='build' /&gt;
          &lt;mkdir dir='build\debug' /&gt;
          &lt;mkdir dir='build\release' /&gt;
      &lt;/target&gt;
      &lt;!-- --&gt;
      &lt;target name='debug' depends='cleandeb, init' description='Compiles the projects in debug mode'&gt;
          &lt;csc target='library' output='build\debug\${project::get-name()}.dll' rebuild='true' debug='true'&gt;
              &lt;sources&gt;
                  &lt;include name='src\app\DWS.WI.Data.Common\*.cs' /&gt;
                  &lt;include name='src\app\DWS.WI.Data.Common\Properties\AssemblyInfo.cs' /&gt;
              &lt;/sources&gt;
          &lt;/csc&gt;
          &lt;csc target='library' output='build\debug\DWS.WI.Data.Oracle.dll' rebuild='true' debug='true'&gt;
              &lt;references&gt;
                  &lt;include name='build\debug\DWS.WI.Data.Common.dll' /&gt;
              &lt;/references&gt;
              &lt;sources&gt;
                  &lt;include name='src\app\DWS.WI.Data.Oracle\*.cs' /&gt;
                  &lt;include name='src\app\DWS.WI.Data.Oracle\Properties\AssemblyInfo.cs' /&gt;
              &lt;/sources&gt;
          &lt;/csc&gt;
          &lt;csc target='library' output='build\debug\DWS.WI.Data.SQL.dll' rebuild='true' debug='true'&gt;
              &lt;references&gt;
                  &lt;include name='build\debug\DWS.WI.Data.Common.dll' /&gt;
                  &lt;include name='libs\Microsoft.SqlServer.ConnectionInfo.dll' /&gt;&gt;
                  &lt;include name='libs\Microsoft.SqlServer.Smo.dll' /&gt;
                  &lt;include name='libs\Microsoft.SqlServer.SqlEnum.dll' /&gt;
              &lt;/references&gt;
              &lt;sources&gt;
                  &lt;include name='src\app\DWS.WI.Data.SQL\*.cs' /&gt;
                  &lt;include name='src\app\DWS.WI.Data.SQL\Properties\AssemblyInfo.cs' /&gt;
              &lt;/sources&gt;
          &lt;/csc&gt;
      &lt;/target&gt;
      &lt;target name='test' depends='debug'&gt;
          &lt;csc target='library' output='build\debug\DWS.WI.Data.Fake.Test.dll' debug='true'&gt;
              &lt;sources&gt;
                  &lt;include name='src\test\DWS.WI.Data.Fake.Test\*.cs' /&gt;
              &lt;/sources&gt;
              &lt;references&gt;
                  &lt;include name='build\debug\DWS.WI.Data.Common.dll' /&gt;
                  &lt;include name='build\debug\DWS.WI.Data.Fake.dll' /&gt;
                  &lt;include name='tools\nunit\nunit.framework.dll' /&gt;
              &lt;/references&gt;
          &lt;/csc&gt;
      &lt;/target&gt;
  &lt;/project&gt;
  </code></pre>