2

I want to manualy set an Version of program in Delphi project, without IDE. When I change a *.dproj file like this:

  <VersionInfo>
    <VersionInfo Name="IncludeVerInfo">True</VersionInfo>
    <VersionInfo Name="AutoIncBuild">False</VersionInfo>
    <VersionInfo Name="MajorVer">1</VersionInfo>
    <VersionInfo Name="MinorVer">2</VersionInfo>
    <VersionInfo Name="Release">3</VersionInfo>
    <VersionInfo Name="Build">456</VersionInfo>
    <VersionInfo Name="Debug">False</VersionInfo>
    <VersionInfo Name="PreRelease">False</VersionInfo>
    <VersionInfo Name="Special">False</VersionInfo>
    <VersionInfo Name="Private">False</VersionInfo>
    <VersionInfo Name="DLL">False</VersionInfo>
    <VersionInfo Name="Locale">1049</VersionInfo>
    <VersionInfo Name="CodePage">1251</VersionInfo>
  </VersionInfo>
  <VersionInfoKeys>
    ...
    <VersionInfoKeys Name="FileVersion">1.2.3.456</VersionInfoKeys>
    ...
    <VersionInfoKeys Name="ProductVersion">1.2.3.456</VersionInfoKeys>
  </VersionInfoKeys>

and then build project through CMD with MSBuild:

call rsvars.bat
MSBuild.exe blabla.dproj /p:configuration=release

I get the *.exe file with empty Version Info in file properties

But when I set the version in the IDE and build using the same MSBuild calling, everything works fine. *.exe have the Version Info

QUESTION: Why do I get different resuslt with the SAME *.dproj file?

Sergey Konkin
  • 95
  • 1
  • 3
  • 9
  • 1
    i think you should change RC/RES file as VERSIONINFO is part of Windows PE-EXE resources. I think that DPROJ file merely contains values that are exported by delphi into RC file. So you should read if MSBuild does compile the resources (AFARIR it does and 1st command calls brc.exe) and if it does - edit textual `ProjectName.RC` and if it does not then edit binary `ProjectName.RES` PS. please edit your question and add TAG with delphi version below the question text – Arioch 'The Jul 18 '13 at 08:14
  • 1
    Don't you need to force a complete rebuild with `/t:Rebuild`? – David Heffernan Jul 18 '13 at 09:02
  • Rebuild does not help – Sergey Konkin Jul 18 '13 at 09:27
  • 1
    track which files are being red during compilation using SysInternals Process Monitor. you should see RC or RES files linked into EXE, and those files should contain VERSIONINFO resource – Arioch 'The Jul 18 '13 at 09:36
  • FWIW, I disable the IDE's version resource handling and script it all myself. I have a pre-build script which generates an rc file, compiles it and so on. I've never found the IDE's handling of this area much cop. – David Heffernan Jul 18 '13 at 09:38
  • 1
    While it's not MSBuild related, you can use something like [this](http://stackoverflow.com/a/11782584/62576) instead of using the IDE's built-in version support, and then use a pre-build event to update it. Adding the resource script properly to the code will then recompile it as part of the Delphi build process automatically for you. – Ken White Jul 18 '13 at 12:54

1 Answers1

1

Normally when you delete the MyProject.res file, normally Delphi should be able to reconstruct it again from the other project data.

I know the IDE does, check if the command line compiler does also. In the little work I did with Delphi XE2 I've seen a cgrb.exe (Code Gear Resource Builder) that does just that.

So when updating the version numbers in the .dproj, delete the .res and have the build process re-create it.

Stijn Sanders
  • 35,982
  • 11
  • 45
  • 67