How does MSBuild check whether a target is up to date or not?

前端 未结 2 1410
一向
一向 2021-02-13 21:50

MSBuild emits the following message for up to date targets:

Skipping target \"MyTarget\" because all output files are up-to-date with respect to the input files.         


        
2条回答
  •  名媛妹妹
    2021-02-13 22:33

    Check flow of Incremental Build:

    A target element can have both an Inputs attribute, which indicates what items the target > expects as input, and an Outputs attribute, which indicates what items it produces as output MSBuild attempts to find a 1-to-1 mapping between the values of these attributes. If a 1-to-1 mapping exists, MSBuild compares the time stamp of every input item to the time stamp of its corresponding output item. Output files that have no 1-to-1 mapping are compared to all input files. An item is considered up-to-date if its output file is the same age or newer than its input file or files.

    If all output items are up-to-date, MSBuild skips the target. This incremental build of the target can significantly improve the build speed. If only some files are up-to-date, MSBuild executes the target but skips the up-to-date items, and thereby brings all items up-to-date. This is known as a partial incremental build.

提交回复
热议问题