自动构建脚本
如何增加 delphi 项目的项目文件中的版本。我正在使用 Delphi 10 进行 win32 应用程序开发。 我由 bdsproj、dpr 和 项目的 res 文件。
How can I increment version in project files for delphi projects.I am using Delphi 10 for win32 application development. I consists of bdsproj, dpr & res files for a project.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
如果您使用delphi构建应用程序,则可以在projectsettings下打开buildnumber的自动递增。
我们使用自制实用程序根据 ini 文件中的值生成版本资源(rc 文件)。 然后我们将 rc 文件编译为 res 文件,并将其包含在项目中。
我们使用 Finalbuilder-scripts 来自动化该过程。 我知道 FinalBuilder 有自己的版本号支持,但我们不使用它。 我不知道为什么,但...
If you are using delphi to build your application, you can turn on auto-incrementation of buildnumber under projectsettings.
We use a self made utility to generate a version resource (rc-file) based on values in a ini-file. Then we compile the rc-file into a res-file, that we include in the project.
We use finalbuilder-scripts to automate the process. I know finalbuilder has its own support for versionnumbers, but we don't use it. I don't know why, though...
我以前使用过一个名为 StampVer 的程序,您需要文件中已有版本信息才能使用 StampVer。 StampVer 是免费软件,但不是开源软件。
stampver 的好处是它可以为您自动递增。
I previously used a program called StampVer, You will need to already have version information in the file to use StampVer. StampVer is Freeware but not Open Source.
The nice thing about stampver, is that it can auto-increment for you.
我使用正确的构建脚本工具 FinalBuilder 它有一组属性管理命令,可以设置中的所有项目构建到相同版本。 这使我能够在整个构建以及整个负载中保持编号的一致性。 如果您没有合适的构建工具,并且仍在使用批处理文件或等效工具,那么现在是查看选项的好时机。 非常值得做。
I use a proper build script tool FinalBuilder which has a set of property management commands which can set all items in a build to the same version. This gives me consistency of numbering across a build, and a whole load more too. If you don't have a proper build tool, and are still using batch files or equivalent, now is a good time to go look at the options. Well worth doing.
我使用一个程序来管理 .ini 文件中的版本号,并在项目的预构建事件中生成 .res 文件。 此 .res 文件仅包含版本,不包含图标。 该图标包含在单独的 .res 文件中。 两者都包含在项目的 dpr 文件中:
只有 *__i_con.res 文件被签入源代码控制,如上所述,版本保存在 .ini 文件中,因此可以在需要时生成 *_version.res 文件。 这消除了 .res 和 .dproj 文件由于内部版本号的增加而不断变化的烦恼。
哦,我刚刚意识到你说的是“Delphi 10”,我认为是Delphi 2006。那个Delphi版本没有构建前和构建后事件,所以你必须自己调用程序来维护版本。
I use a program that manages the version number in a .ini file and generates a .res file in the pre-build event of the project. This .res file contains only the version, not the icon. The icon is contained in a separate .res file. Both are being included in the project's dpr file:
Only the *__i_con.res file gets checked into source conntrol, the version, as said above is maintained in an .ini file, so the *_version.res file can be generated whenever necessary. This gets rid of the annoyance of the .res and .dproj file constantly changing due to incrementing the build number.
Oh, I just realized that you said "Delphi 10", which I think is Delphi 2006. That Delphi version did not have pre- and post-build events, so you would have to call the program for maintaining the version yourself.
阅读这篇文章 http://www.thedelphigeek .com/2008/01/tdm-rerun-2-better-build-process.html
作者:Primoz Gabrijelcic,最初发表于《德尔福杂志》。 它包含您需要做什么的完整描述。
Read this article http://www.thedelphigeek.com/2008/01/tdm-rerun-2-better-build-process.html
by Primoz Gabrijelcic, originally published in The Delphi Magazine. It contains a complete description on what you need to do.
如果您正在寻找一种非 GUI 方式来执行此操作,那么我认为如果您查看 bdsproj 文件,您会在 xml 中找到编写版本的部分,您可以在此处更改它。 下次构建时将使用此版本。
If you are looking for a non-gui way of doing this then I think if you look in the bdsproj file you will find a section in the xml where the version is written you can change it here. The next time it builds it will use this version.
DDevExtensions 有一个构建增量器,我不知道如何获得 delphi 2006 版本,但我认为它存在并且非常方便。
DDevExtensions has a build incrementer in it, I'm not sure how to get the delphi 2006 version, but I think it exists and it's pretty handy stuff.
从 IDE 或外部编译时是否需要增加内部版本号? IDE 可以自动递增它,只需检查项目设置中的标志即可。
在 IDE 外部增加该数字并不简单,因为它存储在由 IDE 管理和重新生成的默认 .res 文件中。
命令行编译器不会修改它。 有多种方法可以修改它(正如其他答案所解释的那样),通常它与可以生成构建号的构建系统配合使用效果最好,特别是当多个开发人员参与该项目时。
我发布了 QC #70564 问题来询问版本信息可以通过命令行编译器设置。
Do you need to increment the build number when you compile from the IDE, or outside? The IDE can increment it automatically, just check the flag in the project settings.
Incrementing that number outside the IDE is not simple because it is stored in the default .res file which is managed and regenerated by the IDE.
The command line compiler will not modify it. There are several ways to modify it (as other answer explain), and usually it works best with a build system that can generate the build numbers, especially if more than one developers work on the project.
I posted QC #70564 issue to ask that version info can be set by the command line compiler.