Set Delphi 7 project "Version Info" from code?
Is it possible to set the "Version Info" settings from code? I'd like to set the version numbering and the value for the "Comments" pro开发者_运维问答perty without using the project options dialog.
Rather than editing the binary RES file that the IDE manages for you, you may find it easier to maintain a text RC file that contains the version-info resource. Write the resource-script file, and then include it in your project with a line like this:
{$R resources.res resources.rc}
You should remove the {$R *.RES}
line from your project's DPR file, or else you'll get duplicate version resources. Do not use your project name as the name of your custom resource file; that name is reserved by the IDE.
The IDE-managed resource file also contains the project icon, so you'll need to include that in your resource script as well.
You can edit the resource script by hand, or you can write a program to edit it or regenerate it as one of your build steps.
Using a text resource script has the added side effect that it's easier to track changes to it in whatever source-control system you use, like CVS.
Solution would be to edit a project resource file. Check this c++ example http://www.codeproject.com/KB/cpp/UpdateVersion.aspx
I would recommend using a build tool, like FinalBuilder (which I use a lot), which can do this for you according to an appropriate scheme. Then you know that the build options are all as you wish, your numbers are incremented appropriately, and you can do things like upload to FTP site and lots more. In my scripts, the build number is included all the way through from EXE to installer and all.
You have to write wizard for that. Check out IOTAProjectOptions in D7IOTA.HLP file, source code of ToolsAPI unit and this thread
You'll need to overwrite the application resources. Good starting point would be probably XN Resource Editor which comes with source code http://www.wilsonc.demon.co.uk/d10resourceeditor.htm
worth reading is also Inno Setup (which does set icon for executable output) - http://jrsoftware.org/isdl.php
精彩评论