-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
[This is based on feedback from connect.microsoft.com.]
If you have:
- A project that copies some files to the output directory (call it
ClassLibraryIndirect) - A project that depends on
ClassLibraryIndirect(call itClassLibraryDirect) - A project that depends on
ClassLibraryDirect(call itIncrementalClean)
And you build using Visual Studio, some very surprising behavior can occur.
Demo projects: https://github.com/rainersigwald/IncrementalCleanDemo
On the first (full) build of the main project, the output file is present in ClassLibraryIndirect's bin directory, and in IncrementalClean's--as expected. Content files should be transitively passed along. Selected state.
If you make a change to the main project (to get VS's fast-up-to-date check to cause an actual build) and build just it again, the content file gets deleted from the main project's bin directory. changes
Looking through a diag-level log of the second build, the problem is that the IncrementalClean target deletes the file, because it incorrectly thinks it's no longer an output.
This does not happen when building from the command line using no special properties.
But it does happen when building from the command line setting the property BuildProjectReferences=false, which simulates Visual Studio's mechanism of building individual projects.
Whether or not a project is built in isolation should not affect the outputs it produces.