Folder.RemoveContent - ReadOnly files

Mar 12, 2012 at 4:29 PM

I'm calling Folder.RemoveContent on a folder where there can be some ReadOnly files; my assumption was that with setting Force="true" that it would handle such a case but it appeared I needed to add a step to remove any readonly flags prior to invoking RemoveContent. I'm not sure if this is by design or not but it could be handy if there was a mechanism to handle readonly files with this task, be it a new property or letting Force take care of it.

 

<MSBuild.ExtensionPack.FileSystem.Folder TaskAction="RemoveContent" Path="@(DeployPackageFolderItem)" Force="true"
    RetryCount="5" Condition="Exists(%(DeployPackageFolderItem.FullPath)) AND $(RemovePackageFilesAfterZip) == true" />

 

Coordinator
Mar 14, 2012 at 11:37 PM

Force is provided to take care of that. I just created a folder with a file a and folders with subcontent. I set all to read only. If I run without force I get the 5 attempts and a fail. If I add Force="true" it cleans out the content immediately.

What is @(DeployPackageFolderItem)? A normal path? A share?

 

Mike