Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / XML

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

0.00/5 (No votes)
25 Feb 2011CPOL 22.9K  
Resolve MSB4064

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:

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

To the following:

XML
<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.

XML
<!--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=...> 
        <Properties>ProjectToolsVersion=3.5</Properties>
        <Targets></Targets>
    </SolutionToBuild>
-->

I hope it helps!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)