如何重新创建“默认”从命令行获取 .res 文件?
当项目的“默认”.res 文件丢失时,当您在 IDE 中打开项目时,Delphi 将重新创建它。可以从命令行调用此功能吗?
背景:
项目处于版本控制之下,其 .res 文件未签入(关于原因的一些思考可以在 此处)。该项目会自动签出并从命令行构建。现在的问题是缺少 .res 文件,导致构建失败。我可以通过命令行调用 IDE 使用的自动创建功能吗?否则,我似乎被迫签入 .res 文件。
When the "default" .res file of your project is missing Delphi will offer to recreate it when you open the project in the IDE. Can this functionality be invoked from command line?
Background:
A project is under version control, its .res file is not checked in (some musings about why can be found here). The project is checked out automatically and build from command line. The problem now is the missing .res file which causes the build to fail. Can I somehow invoke the auto-creation feature the IDE uses from command line? Otherwise it seems like I am forced to check in the .res file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,Delphi 中没有命令行工具来重新创建默认资源文件。
这样也好,因为您不需要默认的资源文件。它将包含通用版本号和通用图标,您显然不希望在任何对于自动化构建足够重要的项目中使用它们。
二进制资源文件在源代码管理中表现不佳,这就是引发另一个问题的原因。相反,编写 .rc 文件,并将它们编译为构建的一部分。 Delphi 将不再自动递增构建编号,但是通过在编译之前更新 .rc 文件(或生成包含文件),可以很容易地在构建脚本中重现该构建编号。
如果您确实想要一个二进制资源文件,那么您可以将其存储在源代码管理中,但名称或位置与编译器期望找到的名称或位置不同。签出后但构建之前,将其复制到正确的位置。对副本的更改不会记录在源代码管理中。
No, there is no command-line tool in Delphi to re-create the default resource file.
That's just as well since you don't need the default resource file. It would contain a generic version number and a generic icon, which you obviously don't want in any project important enough for automated builds.
Binary resource files don't do well in source control, which is what prompted the other question. Write .rc files instead, and compile them as part of your build. Delphi won't auto-increment build numbers anymore, but it's easy enough to reproduce that in your build script as well by updating your .rc file (or generating an included file) prior to compilation.
If you really want a binary resource file, then you could store one in source control, but under a different name or location than what the compiler expects to find. After checkout but before the build, copy it into the proper location. Changes to the copy won't be recorded in source control.