DevInstallerAddVersioningInfo

How to add versioning information to be shown in "Installed Programs" (Windows-only)?

Question from mailing list: "How to add version information into windows control panel for NetBeans platform applications? When the installer ran then it only added "Installed On" information for my application."

Solution

What you are asking about is the information shown in MS Windows Control Panel --> Installed Programs (at least that's how you find it on Win7). First thing to realize is that Windows treats this pretty much as display info. It serves no other purpose than to be displayed in that window. It is up to the software publisher how many of these properties he wants to define. You can find a list of these properties here:

http://msdn.microsoft.com/en-us/library/aa372105%28v=vs.85%29.aspx


You'll find that even official MS applications, like MS Word, only uses a subset of these properties. The most important ones, IMO, is "DisplayVersion" and "Publisher". Again, remember that this is nothing but text strings. Windows doesn't use them for anything. The one you ask about is "DisplayVersion".


Ok, so how can NBI support this? As these "properties" are nothing but Windows Registry keys you could set them in a native script. However NBI actually has support for this. All you need to do is override your ConfigurationLogic.java file and more specifically override the getAdditionalSystemIntegrationInfo() method to include the Registry keys you want.


Here's what I do:

/**
* Add additional properties that are specific to the platform. Currently
* only used for Windows. These properties will be displayed in the Windows
* Control Panel --> Installed Programs. Some of these will be displayed in
* the window's table (like "Publisher" and "DisplayVersion") while others

* (like "URLInfoAbout") are only displayed when a line in the table is
* highlighted. However the user can customize what columns to show in the
* table by right-clicking on any of the columns.
*
* NBI will take whatever you put in the Map below and set it as Windows
* Registry keys so you need to know the name of the appropriate Windows
* Registry key. Here's a list:
* http://msdn.microsoft.com/en-us/library/aa372105%28v=vs.85%29.aspx
*
* Beware that many of these keys are pretty much unused by software
* publishers, even Microsoft itself. Concentrate on "DisplayVersion" and
* "Publisher".
*
* @return
*/
@Override
public Map<String, Object> getAdditionalSystemIntegrationInfo() {

  Map<String, Object> map = super.getAdditionalSystemIntegrationInfo();

  if (SystemUtils.isWindows()) {
                map.put("DisplayVersion", getString("CL.winsystem.display.version"));
                map.put("Publisher", "Montana Wonder Systems Inc");
                map.put("URLInfoAbout", "http://www.montanawondersys.com");
                map.put("URLUpdateInfo", "http://www.montanawondersys.com");
  }
  return map;
}

With this NBI will take care of setting the Registry Keys.

How you actually override the ConfigurationLogic.java file depends if you're using Ant or Maven. You should be able to figure it out with some Googling.

Provided in the platform-dev mailing list by Peter Hansson

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo