TfsVersion Class | MSBuild Extension Pack Help 4.0.12.0 |
Valid TaskActions are:
GetVersion (Required: TfsBuildNumber, VersionFormat Optional:Major, Minor, BuildNumberRegex, PaddingCount, PaddingDigit, StartDate, DateFormat, BuildName, Delimiter, Build, Revision, VersionTemplateFormat, CombineBuildAndRevision, UseUtcDateOutput: Version, Major, Minor, Build, Revision)
Please Note: The output of GetVersion should not be used to change the $(BuildNumber). For guidance, see: http://freetodev.spaces.live.com/blog/cns!EC3C8F2028D842D5!404.entry
SetVersion (Required: Version, Files Optional: TextEncoding, SetAssemblyVersion, AssemblyVersion, SetAssemblyFileVersion, ForceSetVersion
Remote Execution Support: NA
Inheritance Hierarchy
MSBuild.ExtensionPackBaseTask
MSBuild.ExtensionPack.VisualStudioTfsVersion
Namespace: MSBuild.ExtensionPack.VisualStudio
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 4.0.0.0
The TfsVersion type exposes the following members.
Constructors
Name | Description | |
---|---|---|
![]() | TfsVersion |
Properties
Name | Description | |
---|---|---|
![]() | AssemblyVersion |
Sets the AssemblyVersion. Defaults to Version if not set.
|
![]() | Build |
Gets or Sets the Build version
|
![]() | BuildName |
Sets the name of the build. For Tfs 2005 use $(BuildType), for Tfs 2008 use $(BuildDefinition)
|
![]() | BuildNumberRegex |
Sets the BuildNumberRegex to determine the verison number from the BuildNumber when using in Synced mode. Default is \d+\.\d+\.\d+\.\d+
|
![]() | CombineBuildAndRevision |
Sets whether to make the revision a combination of the Build and Revision.
|
![]() | DateFormat |
Sets the date format to use when using VersionFormat="DateTime". e.g. MMdd
|
![]() | Delimiter |
Sets the Delimiter to use in the version number. Default is .
|
![]() | Files |
Sets the files to version
|
![]() | ForceSetVersion |
Set to true to force SetVersion action to update files that do not have AssemblyVersion | AssemblyFileVersion
present. Default is false. ForceSetVersion does not affect AssemblyVersion when SetAssemblyVersion is false.
|
![]() | Major |
Sets the major version
|
![]() | Minor |
Sets the minor version
|
![]() | PaddingCount |
Sets the number of padding digits to use, e.g. 4
|
![]() | PaddingDigit |
Sets the padding digit to use, e.g. 0
|
![]() | Revision |
Gets or Sets the Revision version
|
![]() | SetAssemblyFileVersion |
Set to True to set the AssemblyFileVersion when calling SetVersion. Default is true.
|
![]() | SetAssemblyVersion |
Set to True to set the AssemblyVersion when calling SetVersion. Default is false.
|
![]() | StartDate |
Sets the start date to use when using VersionFormat="Elapsed"
|
![]() | TextEncoding |
Sets the file encoding. Default is UTF8
|
![]() | TfsBuildNumber |
Sets the Tfs Build Number. Use $(BuildNumber) for Tfs 2005 and 2008.
|
![]() | UseUtcDate |
Set to True to get the elapsed calculation using UTC Date Time. Default is false
|
![]() | Version |
Gets or Sets the Version
|
![]() | VersionFormat |
Sets the Version Format. Valid VersionFormats are Elapsed, DateTime, Synced
|
![]() | VersionTemplateFormat |
Specify the format of the build number. A format for each part must be specified or left blank, e.g. "00.000.00.000", "..0000.0"
|
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)"/> <ItemGroup> <FilesToVersion Include="C:\Demo\CommonAssemblyInfo.cs"/> </ItemGroup> <Target Name="Default"> <!-- Get a version number based on the elapsed days since a given date --> <MSBuild.ExtensionPack.VisualStudio.TfsVersion TaskAction="GetVersion" BuildName="YOURBUILD" TfsBuildNumber="YOURBUILD_20080703.1" VersionFormat="Elapsed" StartDate="17 Nov 1976" PaddingCount="4" PaddingDigit="1" Major="3" Minor="5"> <Output TaskParameter="Version" PropertyName="NewVersion" /> </MSBuild.ExtensionPack.VisualStudio.TfsVersion> <Message Text="Elapsed Version is $(NewVersion)"/> <!-- Get a version number based on the format of a given datetime --> <MSBuild.ExtensionPack.VisualStudio.TfsVersion TaskAction="GetVersion" BuildName="YOURBUILD" TfsBuildNumber="YOURBUILD_20080703.1" VersionFormat="DateTime" DateFormat="MMdd" PaddingCount="5" PaddingDigit="1" Major="3" Minor="5"> <Output TaskParameter="Version" PropertyName="NewVersion" /> </MSBuild.ExtensionPack.VisualStudio.TfsVersion> <Message Text="Date Version is $(NewVersion)"/> <!-- Set the version in a collection of files --> <MSBuild.ExtensionPack.VisualStudio.TfsVersion TaskAction="SetVersion" Files="%(FilesToVersion.Identity)" Version="$(NewVersion)"/> <!-- Set the version in a collection of files, forcing AssemblyFileVersion to be inserted even if it was not present in the affected file --> <MSBuild.ExtensionPack.VisualStudio.TfsVersion TaskAction="SetVersion" Files="%(FilesToVersion.Identity)" Version="$(NewVersion)" ForceSetVersion="true"/> <!-- Get a version number based on the elapsed days since a given date and use a comma as the delimiter --> <MSBuild.ExtensionPack.VisualStudio.TfsVersion TaskAction="GetVersion" Delimiter="," BuildName="YOURBUILD" TfsBuildNumber="YOURBUILD_20080703.1" VersionFormat="Elapsed" StartDate="17 Nov 1976" PaddingCount="4" PaddingDigit="1" Major="3" Minor="5"> <Output TaskParameter="Version" PropertyName="NewcppVersion" /> </MSBuild.ExtensionPack.VisualStudio.TfsVersion> <Message Text="C++ Version: $(NewcppVersion)"/> </Target> </Project>
See Also