title: TeamCity error MSB3021: Unable to copy file
body: <p>I have a TeamCity. I have setup build for my web project (csproj) with msbuild,
  command line parameter is looks like</p>
  
  <blockquote>
    <p>/p:Configuration=%env.Configuration%  /p:outputpath=bin2
    /p:DeployOnBuild=True /p:IsDesktopBuild=false
    /p:DeployTarget=MSDeployPublish
    /p:MsDeployServiceUrl=<em>httppath</em>
    /p:AllowUntrustedCertificate=True /p:MSDeployPublishMethod=WMSVC
    /p:UserName=xxx /p:Password=xxx</p>
  </blockquote>
  
  <p>but build faild all the time with error: </p>
  
  <pre><code>Step 1/1: MSBuild (7s)
  pathxxx\MyPortal.csproj.teamcity: Build target: Build (4s)
  [pathxxx\MyPortal.csproj.teamcity] _CopyWebApplicationLegacy
  [_CopyWebApplicationLegacy] Copy
  [Copy] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets(178, 5): error MSB3021: Unable to copy file "Bin\MyPortal.dll" to "bin2\_PublishedWebsites\MyPortal.csproj\Bin\MyPortal.dll". Could not find a part of the path 'Bin\MyPortal.dll'.
  [Copy] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets(178, 5): error MSB3021: Unable to copy file "Bin\MyPortal.pdb" to "bin2\_PublishedWebsites\MyPortal.csproj\Bin\MyPortal.pdb". Could not find a part of the path 'Bin\MyPortal.pdb'.
  [pathxxx\MyPortal.csproj.teamcity] Project pathxxx\MyPortal.csproj.teamcity failed.
  [Step 1/1] Step MSBuild failed
  </code></pre>
  
  <p>if I removed /p:outputpath=bin2 parameter i see other king of error,</p>
  
  <blockquote>
    <p>The OutputPath property is not set for project
    'MyPortal.csproj.teamcity'.  Please check to
    make sure that you have specified a valid combination of Configuration
    and Platform for this project.  Configuration='TestEnv'  Platform='Any
    CPU'.  You may be seeing this message because you are trying to build
    a project without a solution file, and have specified a non-default
    Configuration or Platform that doesn't exist for this project.</p>
  </blockquote>
  
  <p>I am using xml transformation and I have make shure that TestEnv is exist in all project inside solution.</p>
  
  <p>What it could be ? and how to fix it ?</p>
  
  <p>Thanks.</p>