title: Breaking MsBuild package & deploy into separate MsBuild and MsDeploy commands
body: <p>I'm having a few problems breaking out an MsBuild package+deploy command into two separate commands. (I need to do this to pass additional parameters to MsDeploy). </p>
  
  <p>The command that works fine looks like this:</p>
  
  <pre><code>msbuild "src\Solution.sln" 
    /P:Configuration=Deploy-Staging 
    /P:DeployOnBuild=True
    /P:DeployTarget=MSDeployPublish
    /P:MsDeployServiceUrl=https://192.168.0.1:8172/MsDeploy.axd
    /P:DeployIISAppPath=staging.website.com 
    /P:AllowUntrustedCertificate=True 
    /P:MSDeployPublishMethod=WmSvc 
    /P:CreatePackageOnPublish=True 
    /P:UserName=staging-deploy 
    /P:Password=xyz
  </code></pre>
  
  <p>The separated packaging command looks like this:</p>
  
  <pre><code>msbuild "src\Solution.sln" 
    /P:Configuration=Deploy-Staging 
    /P:DeployOnBuild=True
    /P:DeployTarget=Package 
    /P:_PackageTempDir=C:\temp\web
  </code></pre>
  
  <p>which works fine. But then the MsDeploy portion:</p>
  
  <pre><code>msdeploy 
   -verb:sync 
   -allowUntrusted 
   -usechecksum
   -source:manifest=
    'src\WebProject\obj\Deploy-Staging\Package\WebProject.SourceManifest.xml'  
   -dest:auto,ComputerName=
    'https://192.168.0.1:8172/MsDeploy.axd?site=staging.website.com',
     username='staging-deploy',password='xyz',authType='basic',includeAcls='false'
   -enableRule:DoNotDeleteRule
  </code></pre>
  
  <p>fails, with the following error in WmSvc.log</p>
  
  <pre><code>wmsvc.exe Error: 0 : Attempted to perform an unauthorized operation.
  setAcl/C:\temp\web (Read)
  ProcessId=15784
  ThreadId=31
  DateTime=2011-03-30T14:57:02.4867689Z
  Timestamp=3802908721815
  wmsvc.exe Error: 0 : Not authorized.
  Details: No rule was found that could authorize user 'staging-deploy', 
           provider 'setAcl', operation 'Read', path 'C:\temp\web'.
  </code></pre>
  
  <p>(and several more Read/Write operations)</p>
  
  <p>Something is clearly going wrong with the paths it's trying to access (as it works fine with the other method) - I'm not sure it's even trying to use the iisApp targeting correctly, and at the moment I don't think the correct web.config's will be deployed either.</p>