ClickOnce publish is missing files if multiple Content entries are set from a Task
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 141
Description
### Steps to reproduce
Here is the test project I built to demonstrate the issue.
[MSBuildFileCopyIssue.zip](https://github.com/microsoft/msbuild/files/4383215/MSBuildFileCopyIssue.zip)
I was refining the include set for CEF# to make it as minimal as possible when I encountered this.
The changes to the project were minimal (and are attached) from the baseline project:
* I added a top level property group to the project to move the default configuration and platform if unspecified.
* I set the CefSharpAnyCpuSupport to true (project remained AnyCPU).
* Added a BrokenVersion property that will switch between the two tasks, one of which works, one that doesn't.
* Moved the Cef deploy to another folder so they aren't included in the deploy to ..\CEF_$(Configuration) using CefSharpTargetDir so it isn't automatically including everything.
Then I added the following tasks:
* Broken Task:
```
%(RecursiveDir)%(FileName)%(Extension)
PreserveNewest
Included
false
%(RecursiveDir)%(FileName)%(Extension)
PreserveNewest
Included
false
%(RecursiveDir)%(FileName)%(Extension)
PreserveNewest
Included
false
%(RecursiveDir)%(FileName)%(Extension)
PreserveNewest
Included
false
%(RecursiveDir)%(FileName)%(Extension)
PreserveNewest
Included
false
%(RecursiveDir)%(FileName)%(Extension)
PreserveNewest
Included
false
```
* Working Task:

When I publish via Visual Studio, not all files are published. Running a diagnostic build is showing that the link looks incorrect for all entries after the first in the Task.
1> Content=
1> ..\packages\cef.redist.x64.79.1.36\CEF\locales\en-GB.pak
1> CopyToOutputDirectory=PreserveNewest
1> Link=icudtl.dat
1> PublishState=Included
1> Visible=false
1>Added Item(s):
1> Content=
1> ..\packages\cef.redist.x64.79.1.36\CEF\chrome_elf.dll
1> CopyToOutputDirectory=PreserveNewest
1> Link=icudtl.dat
1> PublishState=Included
1> Visible=false
1> ..\packages\cef.redist.x64.79.1.36\CEF\d3dcompiler_47.dll
1> CopyToOutputDirectory=PreserveNewest
1> Link=icudtl.dat
1> PublishState=Included
1> Visible=false
Binaries directory content:

Publish directory content:

Command line
Publish from Visual Studio
### Expected behavior
The same as when BrokenVersion is set to false--the full set of files from bin\ published to the Application Files.
### Actual behavior
The published Application files are missing a substantial amount of content.
OS info:

If applicable, version of the tool that invokes MSBuild (Visual Studio, dotnet CLI, etc):

Thank you,
Brent Scriver
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.