6

I have a Delphi XE project and I'm trying to change the version number of the program before building it with MSBuild. Version number information is located in the DPROJ file but if I change these values the version number does not change. I think the reason for this is that when you change version number in the IDE, Delphi saves the changes to both DPROJ and RES files.

Is there a way to compile the RES file from the command line with the changes in DPROJ file? I found this question which suggested saving the version number in an INC file and including that to the project but this feels a bit more complex solution compared to just making changes in DPROJ.

Community
  • 1
  • 1
Ville Salonen
  • 2,654
  • 4
  • 29
  • 34
  • 1
    Personally I have my own pre-build action that generates an .rc file which is then turned into a .res. I don't use the IDE tools at all because they are hard to automate. – David Heffernan Mar 22 '11 at 09:02
  • 1
    @David Would you by any chance have some kind of example of .rc file generation in pre-build action? – Ville Salonen Mar 22 '11 at 09:43
  • 2
    I have a .inc file which I include in my project containing the various parts of version information. This defines the marketing version rather than the x.x.x.x version. The latter is created from the marketing name. I use a Perl script which reads the .inc file and then spits out the .rc file. The formar of the .rc file is well documented. Visual Studio will give you a template. I then compile it with rc. I also generate manifest this way because I want more control than Delphi gives me. – David Heffernan Mar 22 '11 at 12:39

5 Answers5

5

I ended up solving my problem with this answer. First I unchecked "Include version information in project" in Project Options and added VersionInformation.rc with dummy data. When my build batch file is executed, it generates the correct RC file and because that RC file is added in to the Delphi project, MSBuild uses the contained information for built executable.

Community
  • 1
  • 1
Ville Salonen
  • 2,654
  • 4
  • 29
  • 34
5

shameless plug: http://www.dummzeuch.de/delphi/dzprepbuild/englisch.html

dummzeuch
  • 10,975
  • 4
  • 51
  • 158
3

I use FinalBuilder to handle the version info. Isn't the stripped version bundled with your Delphi? If not, it is definitely worth the money. Makes releasing a one click action.

Uwe Raabe
  • 45,288
  • 3
  • 82
  • 130
2

Yes you are right. Delphi keeps the version number in both project file and resource file. Unfortunately, resource files' structure is a bit complicated so it is not easy to update programmatically. When I came across this need, I ended up using a tool "SetVersion.exe" which did the job for me. It might help you as well. See this link.

EDIT

Actually now I remember, I used a different tool named "ChangeRes.exe" and it worked smoothly (but it is not free). You can try both and see which one works for you.

Hemant
  • 19,486
  • 24
  • 91
  • 127
  • 2
    Version resource files are very easy if you use a .rc file to create the resource, because .rc file is just plain text, check [this question](http://stackoverflow.com/q/2087402/255257) already mentioned in @ville's answer. – jachguate Mar 22 '11 at 16:43
-1

Some years ago, I have writed a script to build and increment build number using ruby and rake. Very easy to use.

After the build, the script calls Inno Setup and generates a new installer.