Skip to content

IncrementalClean deletes transitively-acquired content in Visual Studio #1054

@rainersigwald

Description

@rainersigwald

[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 it ClassLibraryDirect)
  • A project that depends on ClassLibraryDirect (call it IncrementalClean)

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions