title: MSBuild UsingTask declaration with AssemblyFile pointing to dll of current project
body: <p>I have a project "Project1" in visual studio which contains a class that implements Microsoft.Build.Utilities.Task. I would like this task to execute after building Project1.</p>
  
  <p>In the project file for "Project1" I have the following:</p>
  
  <pre><code>&lt;UsingTask
      AssemblyFile="$(MSBuildThisFileDirectory)bin\Debug\net462\Project1.dll" 
      TaskName="MyTask"/&gt;
  
  &lt;Target Name="ExecuteMyTask" AfterTargets="Build"&gt;
      &lt;MyTask/&gt;
  &lt;/Target&gt;
  </code></pre>
  
  <p>When I build Project1 it tries to execute MyTask after the build, but it seems that it can't find Project1.dll (even though after building it is there and the path is correct), giving an error along the lines of: "The "MyTask" task was not found"</p>
  
  <p>If I then build a second time everything works fine, assuming because the dll is already there at the start of the process. It seems as if it tries to look for the dll before the build step even though the Target is declared with AfterTargets="Build".</p>
  
  <p>How can I get this task to execute after the build?</p>