Share via


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 workspace created by Team Foundation Build for getting source is $(COMPUTERNAME)$(TeamProject)$(BuildType).

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

Walkthrough: Working with Team Foundation Version Control from the Command Line

How to: Create a Mapped Workspace

How to: Cloak and Uncloak Folders in a Workspace

How to: Customize Build Numbers

Concepts

Understanding Team Foundation Build Configuration Files

Working with Version Control Workspaces

Team Foundation Build Tasks

Reference

Workspace Command

Other Resources

Customizing Team Foundation Build

Team Foundation Build Targets, Tasks, and Properties