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

I am using Msbuild 4.0. When I used Msbuild 3.5, OverwriteReadonlyfiles worked without any problems.

But today, when I tried to use the copy task, I get this problem.

error MSB4064:

The OverwriteReadOnlyFiles parameter is not supported on the Copy request. Verify that the parameter exists in the task and is a public instance custom object.

This is my goal, which has the task of copying

<Target Name="CopyBOM"> <Copy SourceFiles="@(BOM)" DestinationFolder="%(BOM.Destination)" OverwriteReadOnlyFiles="true"> <Output TaskParameter="CopiedFiles" ItemName="CopyBOMFiles" /> </Copy> <Message Text="Copied to BOM: @(CopyBOMFiles)"/> </Target> 

Below is the group of elements that I use in the properties file

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

I have a file with several properties, I confirmed that Toolsversion = 4.0 is located in the whole place. Has anyone come across this? Any way to solve this?

+4
source share
2 answers

Most likely you are dealing with the ToolsVersion problem, even if you say that you checked all your files and their import. Omitting ToolsVersion from the file will reduce it to a lower version, so if all you did was search for "ToolsVersion", you might have missed the file where it was not declared in the <Project> node at all.

Run the command line assembly with the diagnostic level protocol 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, open "MSB4064", then bounce the file, looking for something that defines 2.0.

+6
source

I use OverwriteReadOnlyFiles = "true" without any problems. Try adding Project ToolsVersion = "4.0" to your tag:

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

Source: https://habr.com/ru/post/1391622/


All Articles