Skip to content

Copy task's "skip copies if source and destination are the same" optimization fires when file doesn't exist #9148

Open
@rainersigwald

Description

@rainersigwald
<Project>
    <Target Name="CopyMissingFileOnItself">
      <Copy SourceFiles="Directory\and\file\that\does\not\exist.txt" DestinationFiles="Directory\and\file\that\does\not\exist.txt" />
    </Target>
</Project>
msbuild -v:d
MSBuild version 17.8.0-preview-23418-03+0125fc9fb for .NET Framework
Build started 8/21/2023 3:21:46 PM.
Process = "C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\MSBuild.exe"
MSBuild executable path = "C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\MSBuild.exe"
Command line arguments = ""C:\Program Files\Microsoft Visual Studio\2022\Preview\\MSBuild\Current\Bin\amd64\MSBuild.exe
" -v:d"
Current directory = "S:\play\alkejtlk"
MSBuild version = "17.8.0-preview-23418-03+0125fc9fb"
Some command line switches were read from the auto-response file "C:\Program Files\Microsoft Visual Studio\2022\Preview
\MSBuild\Current\Bin\amd64\MSBuild.rsp". To disable this file, use the "-noAutoResponse" switch.

Assembly loaded during Evaluation: System.Collections.Immutable, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5
f7f11d50a3a (location: C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\System.Collections.Imm
utable.dll, MVID: 5f9ff90f-0d16-4469-a104-76829d3705e2, AppDomain: [Default])
Project "S:\play\alkejtlk\foo.proj" on node 1 (default targets).
Target "CopyMissingFileOnItself" in project "S:\play\alkejtlk\foo.proj" (entry point):
Using "Copy" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f
11d50a3a".
Task "Copy"
Done executing task "Copy".
Done building target "CopyMissingFileOnItself" in project "foo.proj".
Done Building Project "S:\play\alkejtlk\foo.proj" (default targets).


Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.03

. . . but that file doesn't exist. Feels like we should error in that case.

Metadata

Metadata

Assignees

Labels

Area: TasksIssues impacting the tasks shipped in Microsoft.Build.Tasks.Core.dll.Feature: Warning WavesWarnings to enable in opt-in waves. Formerly "strict mode".Priority:3Work that is nice to havetriaged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions