Search code examples
tfsmsbuild-taskdiskspace

Is there any msbuild-task to get free space in a unit in TFS Builds (TFS2008)?


My builds are failing because some times I have no disk-space in my build server. The problem is that the error message is not clear. It fails in any random part and log is not available when this happens.

I was looking for a task to get free space of a unit so I can put a message if disk space is running low... but I can't find any.

Is there any msbuild-task to get free space in a unit in TFS Builds?

I know I can develop a task in C# and do it myself.. but I don't have the time right now.

Thanks.


Solution

  • You can use the MSBuild Extension Pack to do this:

    <!--- Check drive space -->
    <MSBuild.ExtensionPack.Computer.SystemDrive TaskAction="CheckDriveSpace" Drive="DriveLetter:\" MachineName="Name" UserName="UserName" UserPassword="Password" MinSpace="SpaceToTriggerError EX: 500" Unit="Size EX: MB" ContinueOnError="false"/>
    
    <!--- Check drive space on a remote machine -->
    <MSBuild.ExtensionPack.Computer.SystemDrive TaskAction="GetDrives"  MachineName="Name" UserName="UserName" UserPassword="Password" />