Resolve MSB4064: The "Retries" parameter is not supported by the "Copy" task – Team Build

When building Visual Studio 2010 projects on TFS 2008, you may get this error:

MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets(132,11): error MSB4064: The "Retries" parameter is not supported by the "Copy" task. Verify the parameter exists on the task, and it is a settable public instance property.

MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets(130,5): error MSB4063: The "Copy" task could not be initialized with its input parameters.

The item to notice is that Visual Studio 2010 projects by default use the MSBuild V10.0 targets, and the target definitions are updated for TFS 2010 build projects not TFS 2008. A simple way to address this is to add a condition on the project file to use the Visual Studio 2008 build targets instead when the build is not done with Visual Studio. This is done by editing the Visual Studio project file and updating the following entry:

<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

To the following:

<Import Condition="'$(IsDesktopBuild)' == 'true'" Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

<Import Condition="'$(IsDesktopBuild)' == 'false'" Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />

The IsDesktopBuild variable is true when the build is done on Visual Studio. When is false, it is a build done over the command line. For this case, we tell the project to use the v9.0 targets instead.
After making this change, you may now be getting this error:

error MSB4131: The "Reason" parameter is not supported by the "GetBuildProperties" task. Verify the parameter exists on the task, and it is a gettable public instance property.

You can add a property to the SolutionToBuild node as follows:( modify the MSBuild project file):

<SolutionToBuild Include=...>
I hope it helps