简体   繁体   English

如何自动将资源复制到DCU输出文件夹

[英]How to automatically copy resources to the DCU output folder

I would like to know, is there a way to automatically make the IDE/Compiler/other copy all the resource that needs to be linked with the DCU to the DCU output folder. 我想知道,有没有办法自动使IDE /编译器/其他副本需要与DCU链接到DCU输出文件夹的所有资源。

I often use forms that I pre-compile to avoid the needs to recompile the unit all the time in my main projects. 我经常使用我预编译的表单,以避免在我的主项目中一直重新编译单元的需要。 The DCU gets updated, but we need to copy the DFM manually everytime it changes. DCU会更新,但我们需要在每次更改时手动复制DFM。 Same goes for any {$R *.res} specified. 对于指定的任何{$ R * .res}也是如此。 Maybe we could maintain those file directly in the DCU folder... but doesn't quite make sense to have a .DFM in a different folder than a .PAS 也许我们可以直接在DCU文件夹中维护这些文件......但是.DFM与.PAS不同的文件夹中没有意义

I looked for a compiler switch that would do it... Unsuccesfully. 我找了一个可以做到的编译器开关......不成功。

Anyone knows if/how it can be achieved? 任何人都知道是否/如何实现?

I'm using Delphi 2010 我正在使用Delphi 2010

You could create a simple Post Build event which performed the copying. 您可以创建一个执行复制的简单Post Build事件。 That way whenever you did a build, the system would copy the necessary files for you. 这样,无论何时进行构建,系统都会为您复制必要的文件。 The build events are available from the Project Options menu, there is a Pre-build and a Post-Build script. 构建事件可从“项目选项”菜单中获得,有预构建和后构建脚本。

For *.res files you can specify output path in "Project Options | Resource Compiler | Directories and Conditionals | Output directory for .res files" 对于* .res文件,您可以在“项目选项|资源编译器|目录和条件|输出目录中指定.res文件”中指定输出路径

But for *.DFM files you have to use skamradt's suggestion (Post Build event). 但对于* .DFM文件,您必须使用skamradt的建议(Post Build事件)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM