DeleteWorkspaceTask Task
The DeleteWorkspaceTask task deletes the workspace left by the previous build.
Parameters
Property |
Description |
---|---|
TeamFoundationServerUrl |
Specifies the Team Foundation Server URL. For example, http://MyServer:8080. |
Name |
Specifies the workspace name. |
DeleteLocalItems |
Indicates whether local items that are specified in the workspace mappings are deleted or not. If DeleteLocalItems is set to true, the local items are deleted. If DeleteLocalItems is set to false, the local items are not deleted. DeleteLocalItems is set to true when CleanCompilationOutpuOnly and SkipInitializeWorkspace properties are false. DeleteLocalItems is set to false when CleanCompilationOutpuOnly and SkipInitializeWorkspace properties are true. |
Remarks
The DeleteWorkspaceTask task is defined in the Microsoft.TeamFoundation.Build.Tasks.VersionControl.dll. The Microsoft.TeamFoundation.Build.targets file contains an instance of the DeleteWorkspaceTask task that Team Foundation Build uses as a default implementation for the AfterGet target. You can also customize the build process by defining a different instance of the DeleteWorkspaceTask task for a build type in the TFSBuild.proj file.
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 uses the DeleteWorkspaceTask task in the TFSBuild.proj file to delete the specified workspace.
<!-- Add the UsingTask to the top of the TFsBuild.proj file, right after the schema definition-->
<UsingTask TaskName="Microsoft.TeamFounadtion.Build.Tasks.DeleteWorkspaceTask"
AssemblyFile="$(TeamBuildRefPath)\Microsoft.TeamFoundation.Build.Tasks.VersionControl.dll" />
<!-- Add the following XML after the closing </ItemGroup>-->
<!-- and before the closing </Project>-->
</ItemGroup>
<PropertyGroup>
<WorkspaceName>MyWorkspace</WorkspaceName>
</PropertyGroup>
<TargetName="AfterGet">
< DeleteWorkspaceTask
TeamFoundationServerUrl="http://MyTFServer.8080"
Name="$(WorkspaceName)"/>
</Target>
</Project>
The following example shows the default instance of the DeleteWorkspaceTask task that is defined in the Microsoft.TeamFoundation.Build.targets file.
<DeleteWorkspaceTask
Condition=" '$(CleanCompilationOutputOnly)' != 'true' "
TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
Name="$(WorkspaceName)"
DeleteLocalItems="true" />
<DeleteWorkspaceTask
Condition=" '$(CleanCompilationOutputOnly)' == 'true' "
TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
Name="$(WorkspaceName)"
DeleteLocalItems="false" />
See Also
Tasks
How to: Customize Build Numbers
Concepts
Understanding Team Foundation Build Configuration Files