title: How to deploy to a specific Azure virtual directory with Team Foundation Build 2015
body: <p>In the application settings of an Azure Web App you can configure multiple virtual directories and applications:</p>
  
  <p><a href="https://i.stack.imgur.com/svVmF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/svVmF.png" alt="Virtual applications and directories"></a></p>
  
  <p>I have a solution with two web application projects. One is a UI and one is a Web API project. I want my continuous integration build in Visual Studio Team Services to be able to deploy the UI to the site root, and the Web API to the webapi virtual directory.</p>
  
  <p>In the old XAML-based build definitions my solution was to use publish profiles. I would then pass MSBuild arguments such that my publish profiles would be used to deploy the two apps (<a href="https://stackoverflow.com/questions/32027092/azure-continuous-deployment-for-multiple-projects/32032310#32032310">my approach is explained in this question/answer</a>).</p>
  
  <p>These publish profiles still work if I want to publish manually; it's as simple as having one publish profile contain <code>&lt;DeployIisAppPath&gt;mysite&lt;/DeployIisAppPath&gt;</code> and the other contain <code>&lt;DeployIisAppPath&gt;mysite/webapi&lt;/DeployIisAppPath&gt;</code>.</p>
  
  <p>But using the new 2015 Team Foundation Build deploy steps is proving more difficult. What I have at the moment is this:</p>
  
  <p><a href="https://i.stack.imgur.com/h0Jhn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/h0Jhn.png" alt="Build definition with two deployment steps"></a></p>
  
  <p>This works perfectly except for the webapi deployment. This step fails, complaining that:</p>
  
  <blockquote>
    <p>The website mysite/webapi was not found. Please specify a valid website name.</p>
  </blockquote>
  
  <p>Apparently <code>mysite/webapi</code> is not how I specify the virtual directory to deploy to. But I cannot figure out how I'm supposed to specify this in a Azure Web App Deployment step. Does anybody know how to do this?</p>