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.
MSBuild publish task fails - Unable to create directory
-
24-06-2022 - |
Question
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 2
OTHER TIPS
When you ran the task on the TFS server machine, what user did you login as?
When Tfs build runs on a server the process will be run under the user which is configured to run tfs build agent service. So find that user and provide it access to the mentioned path and it will work.