如何重新创建“默认”从命令行获取 .res 文件?

发布于 2024-12-25 09:51:54 字数 308 浏览 0 评论 0原文

当项目的“默认”.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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

悲念泪 2025-01-01 09:51:54

不,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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文