Skip to content

Incremental builds - MSBuild target is skipped on deleted input #12158

@zijchen

Description

@zijchen

Issue Description

Whether a MSBuild target is skipped or not seems to be determined by the timestamps of its inputs, but in the case when an input is deleted (while others remain the same), the target is still skipped regardless.

Steps to Reproduce

Repro here: https://github.com/zijchen/TargetTest

I created a task to zip a folder to output, initial build creates the .zip file, but if I remove any file from the SourceDirectory, the target is skipped even though the .zip file has an outdated set of files.

  <Target Name="ZipOutputPath" AfterTargets="Build" Inputs="@(ZipFiles)" Outputs="$(OutputPath)\output.zip">
    <Message Importance="high" Text="Zipping files @(ZipFiles)" />
    <ZipDirectory
      SourceDirectory="$(MSBuildThisFileDirectory)\Zip"
      DestinationFile="$(OutputPath)\output.zip"
      Overwrite="true" />
  </Target>

Expected Behavior

MSBuild target to be run when input is deleted.

Actual Behavior

MSBuild target is skipped.

Analysis

No response

Versions & Configurations

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: DocumentationIssues about docs, including errors and areas we should extend (this repo and learn.microsoft.com)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions