Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6193277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:05:26+00:00 2026-05-24T03:05:26+00:00

Code snippet from the nsi script: VIProductVersion 1.2.0.0 VIAddVersionKey /LANG=${LANG_ENGLISH} FileVersion 1.1.0.0 I want

  • 0

Code snippet from the nsi script:

VIProductVersion 1.2.0.0   
VIAddVersionKey /LANG=${LANG_ENGLISH} FileVersion 1.1.0.0

I want to set FileVersion to 1.1.0.0 but in file properties it is set to 1.2.0.0. I also noticed that VIProductVersion executed on its own adds FileVersion key and sets its value.

Documentation says that VIProductVersion adds the Product Version but what I see is that FileVersion is actually added. Is this the bug in NSIS? What is the purpose of VIAddVersionKey FileVersion if value it sets is overriden with one set by VIProductVersion?

VIAddVersionKey requires VIProductVersion call, script does not compile otherwise.

Versions I am using: EclipseNSIS 0.9.8; MakeNSIS 2.46. OS: Windows 7.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T03:05:27+00:00Added an answer on May 24, 2026 at 3:05 am

    The version info resource is stored in two parts:

    • VS_FIXEDFILEINFO is a fixed block with product and file versions, VIProductVersion sets this
    • Zero, one or more (multiple languages) string blocks with one or more name=value strings, VIAddVersionKey sets those.

    Some applications use the FileVersion string and fall back to VS_FIXEDFILEINFO::dwFileVersion if the string is not present, other apps only use VS_FIXEDFILEINFO::dwFileVersion etc.

    VIProductVersion "1.2.3.4" will generate a version header that looks like

    1 VERSIONINFO
    FILEVERSION 1,2,3,4
    PRODUCTVERSION 1,2,3,4
    FILEOS 0x4
    FILETYPE 0x1
    

    this is often enough but it will not let you set PRODUCTVERSION != FILEVERSION.

    I would consider this a bug in NSIS, they should add a VIFileVersion command or extend VIProductVersion to VIProductVersion <productver> [filever].

    You can add a feature request on the tracker.

    In the mean time you might be able to work around this by calling resource hacker during the build with !packhdr


    Edit:

    It can be done with 2.46 at compile time with !packhdr, external 3rd party tools (I was unable to get reshacker to import a .rc version resource so I had to convert to .res first) and horrible hacks:

    !macro HackyVIFileVersion reshack gorcjorg fixedfilever
    ;http://www.angusj.com/resourcehacker/
    ;http://web.archive.org/web/20090918063311/http://www.jorgon.freeserve.co.uk/Gorcjorg.zip
    !searchreplace HackyVIFileVersion_id "${__TIME__}" ":" ""
    !define HackyVIFileVersion_cmd "$%TEMP%\nsisVIFV${HackyVIFileVersion_id}.cmd"
    !appendfile "${HackyVIFileVersion_cmd}" `@echo off&setlocal ENABLEEXTENSIONS DISABLEDELAYEDEXPANSION$\n`
    !appendfile "${HackyVIFileVersion_cmd}" `set eh=%TEMP%\exehead%~1.tmp$\n`
    !appendfile "${HackyVIFileVersion_cmd}" `set rh=%~2$\n`
    !appendfile "${HackyVIFileVersion_cmd}" `call "%rh%" -extract "%eh%", "%eh%1.rc", VersionInfo,1,$\n`
    !appendfile "${HackyVIFileVersion_cmd}" `> "%eh%2.rc" echo.LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US $\n` ;must force lang for Gorcjorg
    !appendfile "${HackyVIFileVersion_cmd}" `FOR /F "usebackq tokens=* delims=" %%A IN ("%eh%1.rc") DO ($\n`
    !appendfile "${HackyVIFileVersion_cmd}" `   FOR /F "usebackq" %%B IN ('%%A') DO ($\n`
    !appendfile "${HackyVIFileVersion_cmd}" `       if "%%~B"=="FILEVERSION" (>> "%eh%2.rc" echo.FILEVERSION %~4) else (>> "%eh%2.rc" echo.%%A)$\n`
    !appendfile "${HackyVIFileVersion_cmd}" `   )$\n`
    !appendfile "${HackyVIFileVersion_cmd}" `)$\n`
    !appendfile "${HackyVIFileVersion_cmd}" `call "%~3" /fo "%eh%.res" /r "%eh%2.rc"$\n`
    !appendfile "${HackyVIFileVersion_cmd}" `call "%rh%" -addoverwrite "%eh%", "%eh%", "%eh%.res", versioninfo,1,$\n`
    !appendfile "${HackyVIFileVersion_cmd}" `del "%eh%2.rc"&del "%eh%1.rc"&del "%eh%.res"&del "%~0"`
    !packhdr "$%TEMP%\exehead${HackyVIFileVersion_id}.tmp" '"${HackyVIFileVersion_cmd}" "${HackyVIFileVersion_id}" "${reshack}" "${gorcjorg}" "${fixedfilever}"'
    !undef HackyVIFileVersion_cmd
    !undef HackyVIFileVersion_id 
    !macroend
    
    
    VIProductVersion "1.2.3.4"
    VIAddVersionKey /LANG=1033 FileVersion 5.6.7.8
    VIAddVersionKey /LANG=1033 ProductVersion "1.2.3.4"
    VIAddVersionKey /LANG=1033 Comments "A test comment"
    !insertmacro HackyVIFileVersion "C:\tools\ResHacker.exe" "C:\tools\GoRC.exe" "5,6,7,8"
    

    …and you end up with this version resource:

    1 VERSIONINFO
    FILEVERSION 5,6,7,8
    PRODUCTVERSION 1,2,3,4
    FILEOS 0x4
    FILETYPE 0x1
    {
    BLOCK "StringFileInfo"
    {
        BLOCK "040904e4"
        {
            VALUE "Comments", "A test comment"
            VALUE "FileVersion", "5.6.7.8"
            VALUE "ProductVersion", "1.2.3.4"
        }
    }
    
    BLOCK "VarFileInfo"
    {
        VALUE "Translation", 0x0409 0x04E4
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code snippet from my PowerShell script that... Loops through a
Here is a code snippet from DirectShowNet library, used to open a video file:
I have the following code snippet from a HTML file: <div id=rwImages_hidden style=display:none;> <img
The following is a code snippet from a struts.xml file for Struts 2. If
Below is a code snippet from the file I am working with. I will
Below is a code snippet from a book. Why can serialNumber still be set
Given the following code snippet from inside a method; NSBezierPath * tempPath = [NSBezierPath
This is a code snippet from O'Reilly Learning Opencv, cvNamedWindow(Example3, CV_WINDOW_AUTOSIZE); g_capture = cvCreateFileCapture(argv[1]);
This code snippet is from C# in Depth static bool AreReferencesEqual<T>(T first, T second)
The following code snippet is from The Official GNOME 2 Developer's Guide : GMemChunk

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.