文件跟踪器日志文件格式
在 Visual Studio 2010 中,增量构建是使用文件跟踪器 (Microsoft.Build.Utilities.FileTracker) 完成的。看起来它负责在中间目录上创建这些 *.1.tlog 文件。
我找不到任何对这些 .tlog 文件语法的引用。
它们包含跟踪器跟踪某些工具的执行时读取/写入的文件的路径列表,以便检查应在增量构建中编译哪些文件。但是,这些文件还包含一些特殊字符,例如“^”和“|”。
我注意到的另一件事是,这些文件有时是从 Visual Studio 目标文件编辑的。例如,在 CustomBuildStep 目标上的 Microsoft.CppCommon.targets 中,我发现了以下行:
<!-- Appended tlog to track custom build events -->
<WriteLinesToFile File="$(IntDir)$(ProjectName).write.1.tlog" Lines="@(CustomBuildStep->'^%(Identity)');@(CustomBuildStep->MetaData('Outputs')->FullPath()->Distinct())"/>
因此,这可能意味着项目文件依赖于自定义构建步骤输出。
我的问题是:
- 有谁知道 .tlog 文件语法的参考吗?
- Visual Studio 上的跟踪日志在哪些情况下使用?我知道 CL,也许还知道使用它的 Link 任务,但 Visual Studio IDE 本身似乎使用它来决定是否为某个项目运行 msbuild。
谢谢
编辑
另一个提示:
CanonicalTrackedInputFiles Class
是文档为“规范形式的 .read. 跟踪日志的文件跟踪日志解释器或已扎根 (^) 使其规范的日志”
当我有时间时,我会更深入地研究它。也许这个类和 Microsoft.Build.Utilities 下的其他类可用于帮助我们使用 tlog 文件,而不是直接使用原始文本 tlog 文件。
另请参阅:CanonicalTrackedOutputFiles 类
< /a>, FlatTrackingData 类
当然还有 FileTracker 类
。
In Visual Studio 2010 incremental builds are done using the File Tracker (Microsoft.Build.Utilities.FileTracker). It seems that it is responsible to the creation of these *.1.tlog files on the intermediate directory.
I couldn't find any reference to the syntax of these .tlog files.
They contain a list of paths to files that are read/written while the tracker tracks the execution of some tool, in order to check which files should be compiled in an incremental build. However, these files also contain some special characters such as "^" and "|".
Another thing I noticed was that these files are sometimes edited from Visual Studio targets files. For example, in Microsoft.CppCommon.targets on CustomBuildStep target I found the following line:
<!-- Appended tlog to track custom build events -->
<WriteLinesToFile File="$(IntDir)$(ProjectName).write.1.tlog" Lines="@(CustomBuildStep->'^%(Identity)');@(CustomBuildStep->MetaData('Outputs')->FullPath()->Distinct())"/>
So this probably means that the project file is dependent on the custom build step outputs.
My questions are:
- Does anyone know of a reference for the .tlog file syntax?
- In which cases is the tracker-log used on Visual studio? I know of the CL and maybe Link tasks that use it, but it seems that Visual Studio IDE itself uses it in order to decide whether to run msbuild at all for a certain project.
Thanks
EDIT
Another hint:
CanonicalTrackedInputFiles Class
is document as "the filetracking log interpreter for .read. tracking logs in canonical form or those that have been rooted (^) to make them canonical"
When I have time I'll dig into it a bit more. Perhaps this class and others under Microsoft.Build.Utilities could be used to help us work with tlog files instead of working with the raw text tlog files directly.
See also: CanonicalTrackedOutputFiles Class
, FlatTrackingData Class
and of course FileTracker Class
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这些东西似乎没有在任何地方记录,所以我必须根据试验和错误并通过盯着一些示例
targets
/xml
/< 来解决这个问题code>props 文件:自定义构建步骤手动写入 tlog 文件的原因是 Build|Clean(可能还有其命令行对应项)会刮擦 tlog 文件以查找要删除的文件。它似乎在中间文件夹中查找所有匹配
*.write.tlog
或*.1.write.tlog
的文件,读取文件名列表每个,并删除名为的文件。因此,如果自定义构建步骤知道其输出是什么,它可以简单地将它们记录在 tlog 文件中,并以这种方式与 Build|Clean 交互。(您可以自己尝试一下 - 构建您的项目,创建一些临时文件,将您自己的 tlog 文件添加到包含临时文件路径的项目的中间文件夹中,然后执行“构建|清理”。您的临时文件将与通常的构建工件。)
在 tlog 文件中,没有前缀的文件是输出文件的名称。当您执行“构建|清理”时,这些文件将被删除。
我认为,在注释之前带有
^
的文件 - 也许显然,Build|Clean 不会触及其中任何一个。至于
|
,我只在注释行中见过它,用于分隔不同的文件名。我怀疑这只是一个约定,而不是一些特殊的语法,因为如果您将多个输出文件放在线上,并用|
分隔,Build|Clean 不会删除它们。This stuff doesn't seem to be documented anywhere, so I've had to figure this out based on trial and error and by staring at some example
targets
/xml
/props
files:The reason the custom build step writes to the tlog file by hand is that Build|Clean - and probably its command line counterpart - scrapes the tlog files to find which files to delete. It seems to look for all files matching
*.write.tlog
, or maybe*.1.write.tlog
, in the intermediate folder, read the list of file names in each, and delete the files named. So, if the custom build steps knows what its outputs are, it can simply record them in a tlog file, and interact with Build|Clean that way.(You can try this out yourself - build your project, create some temp files, add your own tlog file to your project's intermediate folder containing the paths to the temp files, then do a Build|Clean. Your temp files will be deleted along with the usual build artefacts.)
In a tlog file, a file with no prefix is the name of an output file. These files are deleted when you do a Build|Clean.
A file with a
^
before it a comment, I think - perhaps obviously, Build|Clean doesn't touch any of these.As for
|
, I've only seen it in comment lines, used to separate different file names. I suspect this is just a convention, and not some special syntax, since if you put multiple output files on line, separated by|
, Build|Clean doesn't delete them.tlog 文件格式现在记录在此处: https://learn.microsoft.com/en-us/visualstudio/extensibility/visual-cpp-project-extensibility?view=vs-2017#tlog-files
The tlog file format is now documented here: https://learn.microsoft.com/en-us/visualstudio/extensibility/visual-cpp-project-extensibility?view=vs-2017#tlog-files
tlog 文件由 MSBuild 中的文件跟踪系统生成。它并不特定于各个编译器,它可以捕获 MSBuild 过程中完成的任何操作的任何文件引用,具体取决于它的配置方式。
The tlog file is generated by the file tracking system in MSBuild. It isn't specific to individual compilers, it can capture any file reference by anything done in the MSBuild process, depending on how it is configured.