Search code examples
visual-studio-2012deploymentmsdeploymsbuild-task

MSBuild publish task fails - Unable to create directory


I have a web project that I want to publish after a successful build. In the Edit Build Definition Window i enter the following in the MSBuild Arguments textbox:

/p:DeployOnBuild=true /p:PublishProfile=PushtoDrott

This profile is working very well locally, and even on our TFS server machine when run in the command line. On the server i use an account with local admin priviliges.

What does not work however is the task. The following error is presented:

C:\Programfiles(x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Deploy\Microsoft.Web.Publishing.Deploy.FileSystem.targets (93): Unable to create directory "\\remote_server_name\disk$\directory". Access to the path '\\remote_server_name\disk$\directory' is denied.

This is most likely a security problem, but how do i go around and solve it? Wich user is the task run by? Is MSBuild handing over this task to some other process?


Solution

  • We found out that the profile could publish the site when the site was stopped. It was most likely a case of IIS locking some file when there are users on the site.