Skip to content

Up to date checks check modification time of symlink, not its target #322

@rainersigwald

Description

@rainersigwald

This came up internally at Microsoft. One of our teams makes heavy use of creating symlinks and using them in the build. This causes problems when the symlink is newly created, but its target is old. In that case, we unnecessarily choose to rebuild.

From that internal thread:

You must examine the timestamp of the actual file, not the symlink file. (For managed code, this means using File.GetLastWriteTime instead of FileInfo.GetLastWriteTime. For native code, it means using GetFileTime instead of GetFileAttributesEx.)

IsUpToDate does the check through NativeMethods.GetLastWriteTimeUtc, which does indeed call GetFileAttributesEx.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions