title: error MSB4006: There is a circular dependency in the target dependency graph involving target
body: <p>I have following target on csproj file using VS2012, i want to run "Publish" on the project once the build has finished.</p>
  
  <p>This gives me following error "error MSB4006: There is a circular dependency in the target dependency graph involving target "AfterBuild""</p>
  
  <pre><code>&lt;Target Name="AfterBuild"&gt;
    &lt;Message Text="Running Publish..." Importance="high"/&gt;
    &lt;MSBuild Projects="$(ProjectPath)" Properties="DeployOnBuild=true;PublishProfile=WebDeploy;CreatePackageOnPublish=True;VisualStudioVersion=11.0"/&gt;
  &lt;/Target&gt;
  </code></pre>
  
  <p>i have tried replacing the MSBuild step with</p>
  
  <pre><code>&lt;Exec Command="$(MSBuildBinPath)\MSBuild C:\MyProj.csproj /p:DeployOnBuild=true /p:PublishProfile=WebDeploy /p:CreatePackageOnPublish=True /p:VisualStudioVersion=11.0" ContinueOnError="false" /&gt;
  </code></pre>
  
  <p>Doing above results in build/publish being run over and over.</p>
  
  <p>i have tried naming target different, calling it via another target to no avail.</p>
  
  <p>How can i run "Publish" on the project without getting into repeated cycles? can this be done in another way?</p>