在构建时更改版本号

编程入门 行业动态 更新时间:2024-10-09 18:21:22
本文介绍了在构建时更改版本号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

作为构建脚本的一部分,我需要将我的 delphi 项目的版本设置为与另一个项目(不是 delphi)相同.有没有办法在不通过 IDE 的情况下控制版本号,例如编译器的命令行参数或类似的东西?谢谢

I need to set the version of my delphi project to be the same as another project (not delphi) as part of a build script. Is there a way to control the version number without going thru the IDE, for example command line param of the compiler or something like that? Thanks

推荐答案

包括一行

{$R 'version.res'}

在您的项目中.并使用您的版本信息创建一个 version.rc 文件.您必须使用 brcc32 在较旧的 Delphi 版本中自己构建资源.在较新的 Delphi 版本中,您可以使用

in your project. And create a version.rc file with your version information. You will have to build the resource yourself in older Delphi versions using brcc32. In newer Delphi versions you can use

{$R 'version.res' 'version.rc'}

让 IDE 为您自动构建它.

to have the IDE build it automatically for you.

最简单的 version.rc 如下所示:

The simplest version.rc would look something like:

1 VERSIONINFO FILEVERSION 9999, 9999, 99, 18048 PRODUCTVERSION 9999, 9999, 99, 18048 FILEOS 0x00000004L // comment: VOS_WINDOWS32 FILETYPE VFT_APP { BLOCK "VarFileInfo" { VALUE "Translation", 0x409, 0x4E4 // comment: 0x4E4 = 1252 } BLOCK "StringFileInfo" { BLOCK "040904E4" { VALUE "CompanyName", "Company Name" VALUE "FileVersion", "9999.9999.99.18048" VALUE "LegalCopyright", "Copyright " VALUE "ProductName", "Product Name" VALUE "ProductVersion", "9999.9999.99.18048" VALUE "Homepage", "www.mydomain" } } }

有关详细信息,请参阅 MSDN 上的 VERSIONINFO 结构.

For more information, please refer to MSDN on the VERSIONINFO structure.

更多推荐

在构建时更改版本号

本文发布于:2023-11-12 02:17:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1580222.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:版本号

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!