Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
MSBuild Reference
 Touch Task
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework General Reference
Touch Task

Sets the access and modification times of files.

The following table describes the parameters of the Touch task.

Parameter

Description

AlwaysCreate

Optional Boolean parameter.

If true, creates any files that do not already exist.

Files

Required ITaskItem[] parameter.

Specifies the collection of files to touch.

ForceTouch

Optional Boolean parameter.

If true, forces a file touch even if the files are read-only.

Time

Optional String parameter.

Specifies a time other than the current time. The format must be a format that is acceptable to the Parse method.

TouchedFiles

Optional ITaskItem[] output parameter.

Contains the collection of items that were successfully touched.

The following example uses the Touch task to change the access and modification times of the files specified in the Files item collection, and puts the list of successfully touched files in the FilesTouched item collection.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<ItemGroup>
    <Files Include="File1.cs;File2.cs;File3.cs" />
</ItemGroup>

    <Target Name="TouchFiles">
        <Touch
            Files="@(Files)">
            <Output
                TaskParameter="TouchedFiles"
                ItemName="FilesTouched"/>
    </Touch>
</Target>
</Project>

Concepts

Other Resources

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker