Heaventools

   English English  Deutsch Deutsch

Easy Way to Update The Version Information

From now on, you don't have to change version variables of all files manually every time you rebuild your project.

Version Information Application developers often need a command-line utility to allow modification of file version information on existing Windows EXE and DLL, or binary RES files.

While these files already contain the Version Information resource (embedded into the executable during linking), Resource Tuner Console enables you to automatically stamp their version during the release process to insure consistency, and allows you to edit specific version number fields individually. If, for whatever reasons, your files contain no Version Information resource, Resource Tuner Console will add this resource for you.

For instance, you have got code that depends on the value of the Product Version property of the setup.exe file, and the installations you have generated are missing the build # portion of that version. You may use Resource Tuner GUI to modify the properties of the setup.exe after you build it, but it is a manual process that you would rather not have to do every time you build a new release.

Another usage for Resource Tuner Console may be to fix the VB6 PE file version numbers, as Visual Basic does not set the release part of the version numbers.

In addition, Resource Tuner Console helps you have your application display the Version Information in different languages depending upon the user's locale.

Every Field in the VERSION_INFO Structure Is Under Your Control

Let's get started with updating the Version Information. For example, we have a file with the Version Information like this:

Info: VS_VERSION_INFO
FileVersion: 1.0.0.0
ProductVersion: 1.0.0.0
Child Type: StringFileInfo
Language/Code Page: 1033/1252
CompanyName: Acme Corporation
FileDescription: Hello World Application
FileVersion: 1.0 (pre-build)
ProductVersion: 1.0
InternalName: Generic application
LegalCopyright: Copyright © 1999 Acme Corp.
LegalTrademarks:
OriginalFilename: application.exe
ProductName:
Comments:

The objective is to update the Version Information to this:

Info: VS_VERSION_INFO
FileVersion: 5.1.4.20
ProductVersion: 5.1.0.0
Child Type: StringFileInfo
Language/Code Page: 1033/1252
CompanyName: My Company Name, Inc.
FileDescription: Yet Another Killer Product
FileVersion: 5.1 (desktop client)
ProductVersion: 5.1
InternalName: Hot product
LegalCopyright: Copyright © 2024 My Company, Inc.
LegalTrademarks: your trademarks here...
OriginalFilename: super_application.exe
ProductName: Super Application
Comments: Powered by ResTuner Console

The Script Used To Update The Version Information

This script code is based on the Update Version Information sample script. It may be helpful to use this example as a template for your own scripts. See also: RTC Usage and Guide To Using Scripts and How To Write Scripts.

Update Version Information

 Sub Main

  'Set Language constant here
  LangID = 1033 ' English-US
  
  'Retrieve CodePage from LanguageID
  CP = ScriptUnit.CodePageFromLangID(LangID)
  PEFileProxy.OpenFile ".\src\super_application.exe"

  if not PEFileProxy.Terminated then
    if PEFileProxy.HasResources then
      ResourcesProxy.SetLanguage LangID, DELETE_IF_EXISTS
      if ResourcesProxy.OpenVersionInfo("1", LangID, CREATE_IF_NOT_EXIST) then
	   
      VersionInfoProxy.SetFileVersion  5, 1, 4, 20, LangID, True, True, True
      VersionInfoProxy.SetProductVersion 5, 1, 0, 0, LangID, True, True, True

      S1 = "My Company"
      S2 = "Yet Another Super Editor"
      S3 = "5.1 (desktop client)"
      S4 = "5.1"
      S5 = "Hot product"
      S6 = "Copyright \0xA9 2024 My Company, Inc."
      S7 = "your trademarks here..."
      S8 = "Super Application"
      S9 = "Powered by ResTuner Console"

  VersionInfoProxy.EditStringFileInfo "CompanyName", S1, CP, LangID, True, True
  VersionInfoProxy.EditStringFileInfo "FileDescription", S2, CP, LangID, True, True
  VersionInfoProxy.EditStringFileInfo "FileVersion", S3, CP, LangID, True, True
  VersionInfoProxy.EditStringFileInfo "ProductVersion", S4, CP, LangID, True, True
  VersionInfoProxy.EditStringFileInfo "InternalName", S5, CP, LangID, True, True
  VersionInfoProxy.EditStringFileInfo "LegalCopyright", S6, CP, LangID, True, True
  VersionInfoProxy.EditStringFileInfo "LegalTrademarks", S7, CP, LangID, True, True
  VersionInfoProxy.EditStringFileInfo "ProductName", S8, CP, LangID, True, True
  VersionInfoProxy.EditStringFileInfo "Comments", S9, CP, LangID, True, True
        
      ResourcesProxy.CloseVersionInfo
      PEFileProxy.SaveAsNewImage ".\release\super_application.exe"
      else
        'Issue a warning in case of error
        PEFileProxy.PostDebugString "Can't open/create Version Info..."
      end if
    end if
  end if
end sub

SAMPLE SCRIPTS LIBRARY

Resource Tuner Console comes with the examples that explain basic functionality and demonstrate many of the features available in Resource Tuner Console. Once installed Resorce Tuner Console, you will find the Demo folder nested within the directory where RTC has been installed. Within this Demo folder, there are 12 subdirectories containig sample scripts and sample executable files.

All sample scripts are ready to run. Select one of the .BAT files located within the Demo folders to execute the sample script. The script will make changes in the test EXE file. The resulting file will be created in the directory named "Release" under the directory containing the script.

Check out the script examples to get an idea of what RTC can do for you.

The Complete Illustrated Step-by-Step Guide To Using Scripts

 

Get Started with a 60-Day Free Trial

Download ResTuner Console and learn how it can make you more productive.

Download Resource Tuner Console Resource Tuner Console runs on all versions of Windows in use today: from 11 to XP, either 32-bit or 64-bit.