I was trying to deploy an artifact containing a Dotnet Core project to a folder on a network mapped machine and it wasn't working, just got error MSB3021: Unable to copy file "E:\bamboo\xml-data\build-dir\44564481-44662786\Blah\obj\Debug\netcoreapp2.0\PubTmp\Out\runtimes\win\lib\netcoreapp2.0\Microsoft.Win32.SystemEvents.dll" to "\\networkmachine\c$\inetpub\wwwroot\blah\runtimes\win\lib\netcoreapp2.0\Microsoft.Win32.SystemEvents.dll". Access to the path '\\networkmachine\c$\inetpub\wwwroot\blah\runtimes\win\lib\netcoreapp2.0' is denied.

The command I was using was this (in a Bamboo msbuild task):

msbuild.exe Blah.sln /p:Configuration=debug /p:DeployOnBuild=True /p:WebPublishMethod=FileSystem /p:PublishProvider=FileSystem /p:publishUrl="\\networkmachine\c$\inetpub\wwwroot\blah" /p:Password=mypassword /p:UserName="NetworkMachine\Bamboo"

I tried various combinations but nothing. Then just to give it a shot, instead of using the c$ admin share on the network machine, I instead added a share directly to the IIS folder with read/write for the Bamboo user on the network machine and it worked perfectly!

All I had to do was modify the publishUrl to point to the share instead of the c$ mapping and everything else was the same. Amazing.