In a Dunit project and exe version info is disabled, how do I get it back?

℡╲_俬逩灬. 提交于 2019-12-08 17:02:23

问题


Why cant I set a version info in a Dunit Test projet? The checkbox is disabled for this projetct, but not for other projects. See the screenshot:


回答1:


You may be missing the {$R *.res} directive in your test project's source. It needs to be in the .dpr or you won't be able to use this feature in the project options.

It should be there by default but occasionally it can get screwed up when adding or removing a unit from a project. When this happens it will look like:

$R *.res} // notice the missing '{'

If this happened and a developer didn't know what they were looking at they may have just deleted the offending line.

Additionally, if the test project started out as a command line project it may not have had this directive to begin with.




回答2:


DUnit unit test projects are not constructed like other delphi projects, and that is why you see that it has no resource file by default, and that in turn, was why the versioninfo tab was disabled until you put the {$R *.RES} declaration in yourself.

DUnit projects can be built in one of two configurations, using a GUI Test Runner (which uses the VCL, but which you typically should not modify, the GUI is fixed in stone), or a console mode test runner. While a console application could have a resource file linked, and could therefore have version information, and in fact many console applications do so, the reason you are seeing what you are seeing is that DUnit's test runner framework and unit-test-projects are not constructed in the way you are used to.

This in turn, confuses the IDE, and the IDE disables the relevant sections. You may be able to add the {$R} back again, and that seems to have worked, since you accepted Kenneth's answer, however I just wanted to add some background information that might help future people who encounter this problem.



来源:https://stackoverflow.com/questions/9891396/in-a-dunit-project-and-exe-version-info-is-disabled-how-do-i-get-it-back

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!