编译可执行文件的创建日期(VC ++ 2005)

时间:2022-10-08 04:54:29

The creation date of an executable linked in VS2005 is not set to the real creation-date of the .exe file. Only a complete re-build will set the current date, a re-link will not do it. Obviously the file is set to some date, which is taken from one of the project-files.

在VS2005中链接的可执行文件的创建日期未设置为.exe文件的实际创建日期。只有完整的重建才会设置当前日期,重新链接不会这样做。显然,文件设置为某个日期,该日期取自其中一个项目文件。

So: is there a way to force the linker to set the creation-date to the real link-date? ­­­­­­­­­­­­­­­­­­­­­­­­­­

那么:有没有办法强制链接器将创建日期设置为真正的链接日期?

4 个解决方案

#1


1  

Delete the executable as part of a pre-link event.

删除可执行文件作为预链接事件的一部分。

Edit: Hah, I forgot about Explorer resetting the creation date if you name a file exactly the same as a file that was recently deleted.

编辑:是的,如果您将文件命名为与最近删除的文件完全相同,我忘记了资源管理器重置创建日期。

Why are you keying off the creation date anyway?

你为什么要关闭创作日期呢?

#2


0  

A complete rebuild will delete that file forcing the linker to create it, hence the reason it gets a new creation date. You could try disabling incremental linking under project properties (Linker | General). If that doesn't do it you could add a build event to delete the exe file and force it to create a new file each time. Both of these things could increase your build time.

完整的重建将删除该文件,强制链接器创建它,因此它获得新的创建日期。您可以尝试在项目属性(链接器|常规)下禁用增量链接。如果没有这样做,你可以添加一个构建事件来删除exe文件并强制它每次创建一个新文件。这两件事都可能会增加您的构建时间。

#3


0  

Deleting the executable doesn't do the job. That's the problem. Also I could not identify any projectfile, whose datetime was the same as the later linked executable. That lets me conclude, that the 'creation date' is an information taken from within some project-file.

删除可执行文件不起作用。那就是问题所在。此外,我无法识别任何项目文件,其日期时间与后来链接的可执行文件相同。这让我得出结论,“创建日期”是从某个项目文件中获取的信息。

The project has 400000 lines, so a full build is no option.

该项目有400000行,因此无法选择完整版本。

#4


0  

What about using somethign like DirDate (or write a little util yourself) to set the creation date and call it from the post-build step?

如何使用像DirDate这样的东西(或者自己编写一些小工具)来设置创建日期并从构建后步骤中调用它?

#1


1  

Delete the executable as part of a pre-link event.

删除可执行文件作为预链接事件的一部分。

Edit: Hah, I forgot about Explorer resetting the creation date if you name a file exactly the same as a file that was recently deleted.

编辑:是的,如果您将文件命名为与最近删除的文件完全相同,我忘记了资源管理器重置创建日期。

Why are you keying off the creation date anyway?

你为什么要关闭创作日期呢?

#2


0  

A complete rebuild will delete that file forcing the linker to create it, hence the reason it gets a new creation date. You could try disabling incremental linking under project properties (Linker | General). If that doesn't do it you could add a build event to delete the exe file and force it to create a new file each time. Both of these things could increase your build time.

完整的重建将删除该文件,强制链接器创建它,因此它获得新的创建日期。您可以尝试在项目属性(链接器|常规)下禁用增量链接。如果没有这样做,你可以添加一个构建事件来删除exe文件并强制它每次创建一个新文件。这两件事都可能会增加您的构建时间。

#3


0  

Deleting the executable doesn't do the job. That's the problem. Also I could not identify any projectfile, whose datetime was the same as the later linked executable. That lets me conclude, that the 'creation date' is an information taken from within some project-file.

删除可执行文件不起作用。那就是问题所在。此外,我无法识别任何项目文件,其日期时间与后来链接的可执行文件相同。这让我得出结论,“创建日期”是从某个项目文件中获取的信息。

The project has 400000 lines, so a full build is no option.

该项目有400000行,因此无法选择完整版本。

#4


0  

What about using somethign like DirDate (or write a little util yourself) to set the creation date and call it from the post-build step?

如何使用像DirDate这样的东西(或者自己编写一些小工具)来设置创建日期并从构建后步骤中调用它?