Touch Task


For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

Sets the access and modification times of files.

The following table describes the parameters of the Touch task.

AlwaysCreateOptional Boolean parameter.

If true, creates any files that do not already exist.
FilesRequired ITaskItem[] parameter.

Specifies the collection of files to touch.
ForceTouchOptional Boolean parameter.

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

Specifies a time other than the current time. The format must be a format that is acceptable to the Parse method.
TouchedFilesOptional ITaskItem[] output parameter.

Contains the collection of items that were successfully touched.

In addition to the parameters listed above, this task inherits parameters from the TaskExtension class, which itself inherits from the Task class. For a list of these additional parameters and their descriptions, see TaskExtension Base Class.

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="">  
    <Files Include="File1.cs;File2.cs;File3.cs" />  
    <Target Name="TouchFiles">  

Task Reference