MSBuild incorrectly including files from another project
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 141
Description
### Steps to reproduce
To recreate the bug:
1. Build solution in attached zip file using msbuild. Solution contains two projects - A and B. Go to the build directory for project B - in the build directory there is B.dll and also incorrectly TextFile.txt (Which is part of project A).
Attached is the sample solution in a zip file
### Expected behavior
Build directory should just include B.dll (Building in Visual Studio produces this correctly)
### Actual behavior
TextFile.txt (Which is part of project A) is included in project B's build directory when building using MSBuild (A.dll is correctly not included)
TextFile.txt is in project A and project A is not a project reference in project B so TextFile.txt should not be included in the build directory when building project B.
Project A is set as a build dependency on project B to control the build order, but this shouldn't cause project A's files to be included in B's build directory as it is not a project reference
### To recreate the sample solution:
1. Create new Visual Studio solution with class library project A.
2. Add text file to project - set build action 'None' and 'Copy to output directory' to 'Copy if newer'
3. Add class library project B
4. Right click project B - click 'Build dependencies' -> 'Project dependencies' - in the dialog tick project A
### Environment data
`msbuild /version` output: 15.6.85.37198
OS info: Windows 10
[MsBuild File Issue.zip](https://github.com/Microsoft/msbuild/files/2428467/MsBuild.File.Issue.zip)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.