MSBuild如何检查目标是否最新? [英] How does MSBuild check whether a target is up to date or not?

查看:86
本文介绍了MSBuild如何检查目标是否最新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MSBuild会针对最新目标发出以下消息:

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.

如何进行实际检查?

推荐答案

检查增量构建:

目标元素可以同时具有Inputs属性,该属性指示 目标>希望将哪些项作为输入以及输出"属性, 指示它产生什么项目作为输出 MSBuild尝试查找一对一映射 这些属性的值之间.如果存在一对一映射, MSBuild将每个输入项的时间戳与时间戳进行比较 其对应的输出项.没有一对一的输出文件 将映射与所有输入文件进行比较.一个项目被认为 如果其输出文件的年龄与输入的年龄相同或较新,则为最新 文件.

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.

如果所有输出项目都是最新的,则MSBuild会跳过目标.这 目标的增量构建可以显着改善构建 速度.如果只有一些文件是最新的,则MSBuild将执行目标 但跳过最新的项目,从而带来所有项目 最新.这称为部分增量构建.

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.

这篇关于MSBuild如何检查目标是否最新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆