Click here to Skip to main content
Licence 
First Posted 18 Jun 2002
Views 77,727
Bookmarked 26 times

Versioning of executables at build time

By | 19 Jun 2002 | Article
A useful tool to incorporate version info during build time

Sample Image - rcversion.gif

Introduction

While building a project, it is sometimes necessary to include the version information. It would be great if this can be implemented as a step in the build process. Here I have provided a tool to prompt the user when a build is done for all the relevant version information and then write this to the project's resource file.

Steps to do

The application is dialog based MFC application. On inputting the value for the projects resource file, the version info is read and displayed. One can modify these values and write it back to the resource file. To include this in your build process in MSDEV, perform the following steps

  • Go to the project settings
  • Choose all configurations
  • Select your resource file
  • Check on Always use custom build step in the General tab.
  • In the Custom build tab enter this in the command field. (without the line break)
  • $(ProjDir)\{your tools directory}\rcversion.exe $(InputPath) rc /l 
    0x409 /fo"$(OutDir)/$(InputName).res" /d "_DEBUG" /d "_AFXDLL" $(InputPath) 

    where {your tools directory} is where you have copied the rcversion.exe

The source code is self-explanatory. Basically, the resource file is read, parsed for the version info and replaced with the new values. One can also pass in command line parameter for the input resource file name in case you would want to use this tool in a standalone way. Because there is dependency in the project to the resource.res, the tool is run only once during fresh build( or rebuild all).

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

srinivas vaithianathan

Web Developer

United States United States

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionIt doesn't work in VC++ 6 Pinmemberbschorre23:30 30 Aug '05  
AnswerRe: It doesn't work in VC++ 6 PinsussAnonymous7:49 31 Aug '05  
GeneralInvoking exe files in c++ Pinmemberl_v_k19:44 22 Jan '04  
General>256 characters bug. PinmemberMattDodd2:48 1 Aug '03  
Generaluh-oh Pinmemberdog_spawn3:49 1 Aug '03  
GeneralRe: uh-oh PinmemberMattDodd4:20 1 Aug '03  
GeneralNice PinmemberBugra Barin19:21 27 Feb '03  
GeneralVisual Sourcesafe PinmemberArnt Witteveen7:08 25 Jun '02  
GeneralRe: Visual Sourcesafe Pinmembersrinivas vaithianathan7:23 25 Jun '02  
I apologize if this gives you the idea that this is an auto-increment utility. It is not. The real reason for this is to prompt the user for version info something one can forget to add during a build. And if you do not need to update the version info you can just press cancel on the dialog box. One good thing is it doesn't prompt you everytime you build (not rebuild)
the prompt.
 
As for source safe, if you need to update a file, you have to check out that file. You could modify this program to perform the check out (call some vss automation functions or run a batch file with the command)
GeneralCrash! PinmemberMel23:14 23 Jun '02  
GeneralRe: Crash! Pinmembersrinivas vaithianathan7:31 24 Jun '02  
GeneralRe: Crash! PinmemberMel8:55 24 Jun '02  
GeneralRe: Crash! PinmemberArnt Witteveen7:11 25 Jun '02  
QuestionAuto-increment Build Number ? PinmemberAnonymous8:40 20 Jun '02  
AnswerRe: Auto-increment Build Number ? Pinmembersrinivas vaithianathan7:34 24 Jun '02  
AnswerRe: Auto-increment Build Number ? PinmemberScott McKenzie15:03 25 Jun '02  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120529.1 | Last Updated 20 Jun 2002
Article Copyright 2002 by srinivas vaithianathan
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid