RemoveContent , and in other tasks of the MSBuild extension package folder, use DirectoryInfo internally.
To access the remote DirectoryInfo handle UNC path , the problem is that you cannot put credentials in the UNC path . Thus, you cannot do what you want directly using only the RemoveContent task.
Workarounds:
- Simple: entitle your build agent
The better: copy the folder to the network drive and use this network drive in your MSBuild task. This can be done using the MSBuild Exec task and the net command.
<Target Name="MapAndRemove"> <Exec Command="net use Z: \\ServerName\ShareName\YourFolder {Password} /user:{User} /yes"/> <MSBuild.ExtensionPack.FileSystem.Folder TaskAction="RemoveContent" Path="Z:\"/> </Target>
The harder: write a custom MSBuild task, doing what you want and that takes credentials as parameters.
source share