TfsSource Class

MSBuild Extension Pack

TfsSource Class MSBuild Extension Pack Help 4.0.12.0
Valid TaskActions are:

Add (Required: ItemPath or ItemCol Optional: Login, Server, Version, WorkingDirectory, Recursive Output: ExitCode)

AddLabel (Required: LabelName, ItemPath or ItemCol Optional: Login, Server, LabelScope, Recursive, VersionSpec, CommentsOutput: ExitCode)

Checkin (Required: ItemPath or ItemCol Optional: Login, Server, Comments, Notes, Version, WorkingDirectory, Recursive, Bypass Output: ExitCode)

Checkout (Required: ItemPath or ItemCol Optional: Login, Server, Version, WorkingDirectory, Recursive Output: ExitCode)

Delete (Required: ItemPath or ItemCol Optional: Login, Server, Version, WorkingDirectory, Recursive Output: ExitCode)

DeleteLabel (Required: LabelNameOptional: Login, Server, LabelScopeOutput: ExitCode)

Get (Required: ItemPath or ItemCol Optional: Login, Server, Version, WorkingDirectory, Recursive, Force, Overwrite, All Output: ExitCode)

GetChangeset (Required: VersionSpec Optional: Login, Server, WorkingDirectory Output: ExitCode, Changeset)

GetWorkingChangeset (Required: ItemPath Optional: Login, Server, WorkingDirectory, Recursive Output: ExitCode, Changeset)

Merge (Required: ItemPath, Destination Optional: Login, Server, Recursive, VersionSpec, Version, Baseless, Force Output: ExitCode)

Resolve (Required: ItemPath or ItemCol Optional: Login, Server, Recursive, Version, Auto, NewName)

GetPendingChanges (Required: ItemPath Optional: Login, Server, Recursive, Version Output: PendingChanges, PendingChangesExist Output: ExitCode, PendingChangesExistItem)

UndoCheckout (Required: ItemPath or ItemCol Optional: Login, Server, Version, WorkingDirectory, Recursive Output: ExitCode)

Undelete (Required: ItemPath or ItemCol Optional: Login, Server, Version, WorkingDirectory, Recursive Output: ExitCode)

Remote Execution Support: NA

Inheritance Hierarchy

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

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

The TfsSource type exposes the following members.

Constructors

  NameDescription
Public methodTfsSource
Top
Properties

  NameDescription
Public propertyAll
Forces all files to be retrieved, not just those that are out-of-date.
Public propertyAuto
Resolves outstanding conflicts between different versions of specified items in the current workspace AcceptMerge, AcceptTheirs, AcceptYours, OverwriteLocal, DeleteConflict, AcceptYoursRenameTheirs
Public propertyBaseless
Set to true to perform a merge without a basis version
Public propertyBypass
Bypasses a gated check-in requirement. Default is false.
Public propertyChangeset
Gets the Changeset details
Public propertyComments
Sets the comments.
Public propertyDestination
Sets the Destination for a Merge
Public propertyExitCode
Gets the ExitCode
Public propertyForce
Implies All and Overwrite.
Public propertyItemCol
Sets the Item Collection of files to use.
Public propertyItemPath
Sets the files or folders to use.
Public propertyLabelName
Sets the Label Name.
Public propertyLabelScope
Sets the Label Scope
Public propertyLogin
Sets the Login. TFS2010 and greater only.
Public propertyNewName
Used to resolve a name collision conflict. Can only be used in conjunction with AcceptMerge and AcceptYoursRenameTheirs. With AcceptMerge, /newname is only valid with conflicts that involve rename and/or undelete. If used, you must supply a new path.
Public propertyNotes
Sets the notes.
Public propertyOverrideText
Lets you set text to override check-in policies
Public propertyOverwrite
Overwrites writable files that are not checked out.
Public propertyPendingChanges
Gets the pending changes in the format '/Format:detailed'
Public propertyPendingChangesExist
Gets whether pending changes exist for a given ItemPath
Public propertyPendingChangesExistItem
Task Item stores whether changes exist for the given ItemPath. Identity stores the path, PendingChangesExist metadata stores boolean.
Public propertyRecursive
Sets whether the Tfs operation should be recursive. Default is true.
Public propertyServer
Sets the TFS Server
Public propertyVersion
Sets the version of Tfs. Default is 2013
Public propertyVersionSpec
Sets the version spec for Get or changeset number for GetChangeset. If no VersionSpec is provided for GetChangeset, then /latest is used.
Public propertyWorkingDirectory
Sets the working directory. If the directory is mapped in a workspace, then there is no need to specify the Server.
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)"/>
    <ItemGroup>
        <FilesToAdd Include="C:\Projects\SpeedCMMI\Demo1\*"/>
    </ItemGroup>
    <Target Name="Default">
        <!-- Check for pending changes -->
        <MSBuild.ExtensionPack.VisualStudio.TfsSource TaskAction="GetPendingChanges" ItemPath="$/AProject/APath" WorkingDirectory="C:\Projects\SpeedCMMI">
            <Output TaskParameter="PendingChanges" PropertyName="PendingChangesText" />
            <Output TaskParameter="PendingChangesExist" PropertyName="DoChangesExist" />
        </MSBuild.ExtensionPack.VisualStudio.TfsSource>
        <Message Text="Pending Changes Report: $(PendingChangesText)"/>
        <Message Text="Pending Changes Exist: $(DoChangesExist)"/>
        <MSBuild.ExtensionPack.VisualStudio.TfsSource TaskAction="GetPendingChanges" ItemPath="$/AProject/ADifferentPath" WorkingDirectory="C:\Projects\SpeedCMMI">
            <Output TaskParameter="PendingChangesExistItem" ItemName="PendingChangesExistItem3" />
        </MSBuild.ExtensionPack.VisualStudio.TfsSource>
        <!-- Get a summary of whether changes exist using the PendingChangesExistItem -->
        <Message Text="%(PendingChangesExistItem3.Identity) = %(PendingChangesExistItem3.PendingChangesExist)"/>
        <!-- Perfrom various other source control operations -->
        <MSBuild.ExtensionPack.VisualStudio.TfsSource TaskAction="Checkout" ItemPath="C:\projects\SpeedCMMI\Demo1" Version="2008" WorkingDirectory="C:\projects\SpeedCMMI"/>
        <MSBuild.ExtensionPack.VisualStudio.TfsSource TaskAction="Checkin" ItemPath="C:\projects\SpeedCMMI\Demo1" WorkingDirectory="C:\projects\SpeedCMMI" Comments="Testing" Notes="Code reviewer=buildrobot" OverrideText="Justdoit" />
        <MSBuild.ExtensionPack.VisualStudio.TfsSource TaskAction="Add" ItemPath="C:\projects\SpeedCMMI\Demo1" Version="2008" WorkingDirectory="C:\projects\SpeedCMMI"/>
        <MSBuild.ExtensionPack.VisualStudio.TfsSource TaskAction="Checkin" ItemCol="@(FilesToAdd)" WorkingDirectory="C:\projects\SpeedCMMI" ContinueOnError="true"/>
        <MSBuild.ExtensionPack.VisualStudio.TfsSource TaskAction="Checkout" ItemCol="@(FilesToAdd)" WorkingDirectory="C:\projects\SpeedCMMI"/>
        <MSBuild.ExtensionPack.VisualStudio.TfsSource TaskAction="UndoCheckout" ItemCol="@(FilesToAdd)" WorkingDirectory="C:\projects\SpeedCMMI"/>
        <MSBuild.ExtensionPack.VisualStudio.TfsSource TaskAction="Delete" ItemCol="@(FilesToAdd)" WorkingDirectory="C:\projects\SpeedCMMI"/>
        <MSBuild.ExtensionPack.VisualStudio.TfsSource TaskAction="Checkin" ItemPath="C:\projects\SpeedCMMI\Demo1" WorkingDirectory="C:\projects\SpeedCMMI" ContinueOnError="true"/>
        <MSBuild.ExtensionPack.VisualStudio.TfsSource TaskAction="Undelete" ItemCol="@(FilesToAdd)" WorkingDirectory="C:\projects\SpeedCMMI"/>
        <MSBuild.ExtensionPack.VisualStudio.TfsSource TaskAction="Checkin" ItemCol="@(FilesToAdd)" WorkingDirectory="C:\projects\SpeedCMMI" ContinueOnError="true"/>
        <MSBuild.ExtensionPack.VisualStudio.TfsSource TaskAction="Get" ItemPath="C:\Projects\SpeedCMMI\Demo1" WorkingDirectory="C:\projects\SpeedCMMI"/>
        <MSBuild.ExtensionPack.VisualStudio.TfsSource TaskAction="Merge" ItemPath="C:\Projects\SpeedCMMI\Client2" Destination="C:\Projects\SpeedCMMI\Client" WorkingDirectory="C:\projects\SpeedCMMI"/>
        <MSBuild.ExtensionPack.VisualStudio.TfsSource TaskAction="Checkin" ItemPath="C:\projects\SpeedCMMI\Client" WorkingDirectory="C:\projects\SpeedCMMI" Comments="Testing" Notes="Code reviewer=buildrobot" OverrideText="Justdoit" />
    </Target>
</Project>
See Also

Reference