locked
MSBuild Community Tasks--Attrib Task RRS feed

  • Question

  • Hello,

    I have been reading about using the Attrib command to remove read-only flags from files and folders.  I have been using the attrib command through the Exec command previously with the /S switch in order to ensure that the attrib command gets processed recursively on all subfolders.  However, I have recently noticed that the MSBuild Community Tasks also contains an Attrib command similar to the NAnt attrib command.  However, while using this, I am having a hard time determining how to achieve the same behavior as using the attrib command at the command line or in the same manner as was available through NAnt.

    Any samples on how to recursively process folders and subfolders using the Attrib command that are part of the MSBuild Community Tasks instead of the command-line version of attrib would be greatly appreciated.

     

    Thanks.

    Thursday, April 15, 2010 1:23 PM

Answers

  • I've not used that task, but looking at the sample provided in the help file,

     

    <Attrib Files="Test\version.txt" ReadOnly="true" Hidden="true" System="true"/>

     

    I would guess you can iterate over a collection and call it, e.g.

    <ItemGroup>
    <Files Include="C:\YourPath\**\*.*/>
    </ItemGroup>
    
    <Attrib Files="%(Files.Identity)" ReadOnly="true"/>

     

     


    Visual Studio ALM MVP
    My Blog | MSBuild Extension Pack | MSBuild Explorer
    • Proposed as answer by Mike Fourie [MVP] Tuesday, April 20, 2010 12:10 PM
    • Marked as answer by Chao Kuo Thursday, April 22, 2010 2:22 AM
    Friday, April 16, 2010 9:23 AM