CreateWorkspaceTask Task

The CreateWorkspaceTask task creates a workspace with the name and mapping file specified in the TFSBuild.proj file.

Parameters

Parameter

Description

TeamFoundationServerUrl

Specifies the Team Foundation Server URL. For example, http://MyServer:8080.

BuildUri

Specifies the build URI.

BuildDirectory

Specifies the build directory.

SourcesDirectory

Specifies the solution root for directory for source files.

Name

Specifies the workspace name.

By default, the name of the workspace created by Team Foundation Build for getting sources is defined by the following expression: [String.Format("{0}_{1}_{2}", BuildAgent.ServiceHost.Name, BuildDetail.BuildDefinition.Id, LinkingUtilities.DecodeUri(BuildAgent.Uri.AbsoluteUri).ToolSpecificId)].

Override the WorkspaceName property in TFSBuild.proj file to use a customized workspace name.

NoteNote
WorkspaceName property is also used to generate the VersionToLabel property. Therefore, if you programmatically override WorkspaceName, be sure to override VersionToLabel as well.

Comment

By default, the comment used for the workspace created by Team Foundation Build is "Workspace created by Team Build."

Override the CreateWorkspaceTaskComment property in TFSBuild.proj file to specify a different comment.

Name

String output parameter. This specifies the value of the property WorkspaceName.

Owner

String output parameter. This specifies the value of the property WorkspaceOwner.

Remarks

The CreateWorkspaceTask task is defined in the Microsoft.TeamFoundation.Build.Tasks.VersionControl.dll. The Microsoft.TeamFoundation.Build.targets file contains an instance of the CreateWorkspaceTask task that Team Foundation Build uses as a default implementation for the InitializeWorkspace target.

The <root>:\Program Files\MSBuild\Microsoft\VisualStudio\TeamBuild folder on the Team Foundation Build computer contains the Microsoft.TeamFoundation.Build.targets file.

Example

The following example shows the default instance of the CreateWorkspaceTask task that is defined in the Microsoft.TeamFoundation.Build.targets file.

<CreateWorkspaceTask
    TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
    BuildUri="$(BuildUri)"
    BuildDirectory="$(BuildDirectory)"
    SourcesDirectory="$(SolutionRoot)"
    Name="$(WorkspaceName)"
    Comment="$(CreateWorkspaceTaskComment)">
    <Output TaskParameter="Name" PropertyName="WorkspaceName" />
    <Output TaskParameter="Owner" PropertyName="WorkspaceOwner" />
    </CreateWorkspaceTask>

See Also

Tasks

Cloak and Uncloak Folders in a Workspace

Customize Build Numbers

Reference

Workspace Command

Concepts

Understanding Team Foundation Build Configuration Files

Create a Workspace to Work with your Team Project

Other Resources

Create a Workspace and Get Files for the First Time

Team Foundation Build Targets, Tasks, and Properties