error MSB4064: The "OverwriteReadOnlyFiles" parameter is not supported by the "Copy" task

5.5k Views Asked by At

I am using Msbuild 4.0. When i was using Msbuild 3.5 OverwriteReadonlyfiles worked without any issue.

But today when i was trying to use the copy task i am getting this issue.

error MSB4064:

The "OverwriteReadOnlyFiles" parameter is not supported by the "Copy" t ask. Verify the parameter exists on the task, and it is a settable public instance property.

This is my target which has copy task

<Target Name="CopyBOM">

    <Copy SourceFiles="@(BOM)" DestinationFolder="%(BOM.Destination)" OverwriteReadOnlyFiles="true">
      <Output TaskParameter="CopiedFiles" ItemName="CopyBOMFiles" />
    </Copy>

    <Message Text="Copied to BOM: @(CopyBOMFiles)"/>


  </Target>

Following is the itemgroup i am using in my properties file

 <BOM Include="..\..\..\Release\CoreDeployment.msi">
      <Destination>..\..\..\Core\BOM\Comp1</Destination>
 </BOM>

I am having multiple properties file, I have verified that in all the place Toolsversion=4.0 is placed. Has any one faced this? Any way is there to solve this?

2

There are 2 best solutions below

1
On BEST ANSWER

You are most likely dealing with a ToolsVersion issue, even though you say you've checked all your files and their imports. Omitting the ToolsVersion from a file will cause it to drop to a lower version, so if all you did was search for "ToolsVersion" you may have missed a file where it wasn't declared on the <Project> node at all.

Run a command line build with diagnostic level logging, with the following additional parameters:

> msbuild My.proj /fl /flp:v=diag;logfile=My.proj.diagnostic.log

After the build fails, open the log file, seach for "MSB4064" then backtrack up the file looking for anything specifying the 2.0 framework.

1
On

I'm using OverwriteReadOnlyFiles="true" without issues. Try to add ToolsVersion="4.0" into your Project tag:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">