title: Automate Web Deploy to remote IIS server
body: <p>I am currently in the process of investigating and implementing an automatic method of deploying our MVC and webApi projects to a production environment.</p>
  
  <p>So far I have used the Publish tool built into Visual Studio 2012 to good effect.  By running this in the IDE I can get the correct files and IIS config up and running on the production server.  I am however, wanting to achieve the same as this, but via command line or powershell so a script can just be run, and it will deploy the 2 websites automatically.</p>
  
  <p>I have tried to do this by running a command line script such as: </p>
  
  <pre><code>msbuild MyProject.csproj /p:DeployOnBuild=true;PublishProfile=MyProfile
  </code></pre>
  
  <p>and this builds the project and creates a package in the obj folder of the project.  Is this the correct approach, and if so, how can I make this package be automatically deployed to the remote server?</p>