CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    May 2002
    Location
    Montreal
    Posts
    450

    Is it possible to change the File Version information at build time?

    I would like to set the file version info (Comment, File Description) found in the project's properties at build time based on the values of some variables. The file info is seen when right-clicking on the exe.
    Is it possible? if so, how?
    Cheers,
    Laurent

    For an aviator, the three best things in life are a good landing, a good orgasm, and a good sh*t. A night carrier landing is one of the few opportunities to experience all three at the same time.

  2. #2
    Join Date
    Dec 2001
    Posts
    6,332
    That is an interesting question. I don't know why you would want to do it, but the first thing that comes to mind is this:

    When the project runs in the IDE, you detect the IDE (do a search for my example on this). At this point you can then open the vbp file and parse the data you want to control, make the changes, and save it either over the original, or to a new file. Then open that project file before compiling.

    Keep in mind I haven't tried this, but it seems like it can work.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  3. #3
    Join Date
    Oct 2003
    Location
    .NET2.0 / VS2005 Developer
    Posts
    7,104
    auto increment is an option available for the version, which rolls up one revision every time a Make is performed. Other things in that box... i havent seen anywhere an ability to set them automatically..
    "it's a fax from your dog, Mr Dansworth. It looks like your cat" - Gary Larson...DW1: Data Walkthroughs 1.1...DW2: Data Walkthroughs 2.0...DDS: The DataSet Designer Surface...ANO: ADO.NET2 Orientation...DAN: Deeper ADO.NET...DNU...PQ

  4. #4
    Join Date
    May 2002
    Location
    Montreal
    Posts
    450
    The reason behind this is that we have a product that we customize along our clients' requests. When they ask for different things but work with the same base product, we just create different flavours of the same product, which allows us to keep the same baseline for all of them. They are all compile with the exe name.
    We just make the flavours by enabling and disabling (crippling) features with simple start variables. So we have cx, ex, lx versions of the same base product.

    With every advantage comes a load of problems, one of them being able to properly keep track of all flavours

    For every make, I have been changing the information in the file description and comment in the file version tab of the project properties to reflect the flavour. This is more for our tech support so that we don't spend an hour with the client trying to figure out what version and flavour they have. We try to make a note of what they use, but we all are humans and make mistakes.

    Wizbang: thanks for your suggestion. It however seems too manual, I need something more automated.

    So far, like cjard mentions, nothing lets us believe that this info can be changed at build time.

    I guess I'll keep doing my usual changes until I can come up with another idea of identifying an exe.
    Cheers,
    Laurent

    For an aviator, the three best things in life are a good landing, a good orgasm, and a good sh*t. A night carrier landing is one of the few opportunities to experience all three at the same time.

  5. #5
    Join Date
    Dec 2001
    Posts
    6,332
    Why not use an "About" box to show the flavor based on a variable? Identification would then be user friendly.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  6. #6
    Join Date
    May 2002
    Location
    Montreal
    Posts
    450
    Good point and we do show the info in the About box.

    Actually this is a great idea. I am showing all this info already but it is not correct when we don't use our licensing control. I'll modify it so that the About box info is independent from the license info.

    The problem (for myself) is that I need to run the code, which is not pratical when I build installation packages. I'd rather right-click on the file and see what it is.

    Tech support will just have to learn to use the About box and I'll keep being careful right now at changing the info when required.
    Cheers,
    Laurent

    For an aviator, the three best things in life are a good landing, a good orgasm, and a good sh*t. A night carrier landing is one of the few opportunities to experience all three at the same time.

  7. #7
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Wizbang suggestion and add-in

    You could make an addin that do the WizBang trick for you...
    Have no time to try, but this is an interesting issue...
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  8. #8
    Join Date
    Dec 2001
    Posts
    6,332
    Hmmm...

    The problem I see is that you still need to compile the different versions, and the about box idea requires that the exe can run. Therefore, if some problem keeps the program from running, they can't see what version it is.

    Perhaps a better solution would be to use a file to control the version. Even a simple txt file would work, and it could be used to see what version is installed even if the program won't run. Better yet, now you only need to compile once, because the txt file can be used by your program to detect the version. So instead of making static variables, it would just look at the file. I would use a single character to set the version, so even if someone edits the file, the program can be error proof. This can happen for instance, if you use an Integer, and the file has a numeric string that requires a Long. So, something like this might work:

    Version:A
    or:
    Version:1

    Then just open the file and get the Ascii value of the character following the ":".
    Parsing this would be easy to do, and you can even change versions without installing a new program.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  9. #9
    Join Date
    May 2002
    Location
    Montreal
    Posts
    450

    Smile

    Wow,

    You're on a roll. I think this is a great idea. The control file can be binary so that it cannot be easily edited.
    Most of our users have no clue anyways but we deal with people who would try to hack if they knew how.
    This way you can 'upgrade' to a different version the existing application by just replacing the control file.

    I had already used a similar concept to set the number of user licenses by using a binary file that we can easily replace if we needed to add more users. We ended up scrapping this project. I can use the logic. I made a little control app to create and read the user license files that I can use to create the control files.
    Cheers,
    Laurent

    For an aviator, the three best things in life are a good landing, a good orgasm, and a good sh*t. A night carrier landing is one of the few opportunities to experience all three at the same time.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured