FileVersion Class

MSBuild Extension Pack

FileVersion Class MSBuild Extension Pack Help 4.0.12.0
Valid TaskActions are:

Increment (Required: File Optional: Increment Output: Value)

Reset (Required: File Optional: Value Output: Value)

Remote Execution Support: No

Inheritance Hierarchy

SystemObject  Microsoft.Build.UtilitiesTask
    MSBuild.ExtensionPackBaseTask
      MSBuild.ExtensionPack.FileSystemFileVersion

Namespace: MSBuild.ExtensionPack.FileSystem
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 4.0.0.0

The FileVersion type exposes the following members.

Constructors

  NameDescription
Public methodFileVersion
Top
Properties

  NameDescription
Public propertyFile
The file to store the incrementing version in.
Public propertyIncrement
Value to increment by. Default is 1.
Public propertyValue
Gets value returned from the file, or used to reset the value in the file. Default is 0.
Top
Examples

<Project ToolsVersion="4.0" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath>
        <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath>
    </PropertyGroup>
    <Import Project="$(TPath)"/>
    <Target Name="Default">
        <!-- Perform a default increment of 1 -->
        <MSBuild.ExtensionPack.FileSystem.FileVersion TaskAction="Increment" File="C:\a\MyVersionfile.txt">
            <Output TaskParameter="Value" PropertyName="NewValue"/>
        </MSBuild.ExtensionPack.FileSystem.FileVersion>
        <Message Text="$(NewValue)"/>
        <!-- Perform an increment of 5 -->
        <MSBuild.ExtensionPack.FileSystem.FileVersion TaskAction="Increment" File="C:\a\MyVersionfile2.txt" Increment="5">
            <Output TaskParameter="Value" PropertyName="NewValue"/>
        </MSBuild.ExtensionPack.FileSystem.FileVersion>
        <Message Text="$(NewValue)"/>
        <!-- Reset a file value -->
        <MSBuild.ExtensionPack.FileSystem.FileVersion TaskAction="Reset" File="C:\a\MyVersionfile3.txt" Value="10">
            <Output TaskParameter="Value" PropertyName="NewValue"/>
        </MSBuild.ExtensionPack.FileSystem.FileVersion>
        <Message Text="$(NewValue)"/>
    </Target>
</Project>
See Also

Reference