如何将版本信息嵌入到 Windows 二进制文件中? [英] How do I embed version information into a windows binary?

查看:30
本文介绍了如何将版本信息嵌入到 Windows 二进制文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可能知道 Windows 有一个选项,您可以在其中查看二进制文件的属性,它将显示有关作者、版本号、公司等的信息...我们希望将其放入我们的自动编译系统中.最好在编译二进制文件后将此版本信息放入二进制文件中,但任何有关如何完成此操作的信息都会有所帮助.当然,这需要程序化;每天为 5000 个二进制文件手动将信息输入到资源黑客中,我们不必费心.

You probably know that Windows has that option where you can view the properties of a binary and it will display information about the author, the version number, the company etc... We would like to put this into our automated compilation system. Getting this version information into the binary after the binary is compiled is preferable, but any information on how this is done would be helpful. And of course, this needs to be programmatic; we can't be bothered to manually enter the information into a resource hacker for 5000 binaries every day.

以前有人做过吗?怎么可能做到?

Has anyone ever done this before? How could it be done?

推荐答案

看起来最好的解决方案(至少对我们来说)是使用 RC 文件.

It looks as though the best solution (for us at least) is to use an RC file.

1 VERSIONINFO
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904E4"
        BEGIN
            VALUE "File Version",      "1.0.4"
            VALUE "Build Number",     "3452"
        END
    END
END

编译成.res文件

rc.exe /fo Results/version.res version.rc

然后与其他目标文件链接.

Which is then linked in with the rest of the object files.

这篇关于如何将版本信息嵌入到 Windows 二进制文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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