Determining the Version of an Executable Built with LabVIEW

Updated Apr 25, 2018

Reported In

Software

  • LabVIEW Application Builder Module

Issue Details

Starting with LabVIEW 8.0, I am able to give an executable I build a version number, including major, minor, build, and fix parts, in the Application Builder settings. Is there a way to extract this information to display it, for instance, in the executable's About page that displays when the User selects Help » About?

Solution

The version can be determined using the FileVersionInfo VI which, in LabVIEW 8.6 and later is found in the fileVersionInfo.llb found in the <LabVIEW 8.6>\vi.lib\Platform directory.  We recommend using this VI rather than the VI included with this document.

For LabVIEW versions prior to 8.6, you can determine the version of an executable using Windows API calls located in the System.Diagnostics.FileVersionInfo class of the Windows System .NET assembly. An invoke node linked to the GetVersionInfo method of this class accepts an input for the path to an executable. The invoke node outputs a reference to this file's version information, which you can wire into a property node.

You can then select various properties from this property node such as FileVersion for the entire version information, as well as FileMajorPartFileMinorPartFileBuildPart, and FilePrivatePart for the respective version parts. This property node also contains properties such as ProductNameInternalProductNameLegalCopyright, and all the attributes that you can set for an executable in the LabVIEW Application Builder.  The example code for this is picture can be found below in GetFileVersion_DotNet.vi.

To obtain this information for a particular executable built with LabVIEW, include a VI in the executable build that uses the Application property node properties Application»Directory Path andApplication»Name to build a path to the executable that is calling this VI.

The System.Diagnostics.FileVersionInfo class installs with the .NET Framework version 1.0 and higher. LabVIEW 8.0 requires the .NET Framework version 1.1 or higher to act as a .NET client. The .NET Framework is a free download from the Microsoft Developer Network, linked below. Refer to the attached example, GetFileVersion_DotNet.vi, for more information. 

If you want to determine the version of an executable, and your system doesn't meet the minimum requirements to use the .NET Framework with LabVIEW, then you can use traditional Windows API calls with the Call Library Function Node. Refer to the attached example GetFileVersionInfo_DLL.llb for more information on this method.

WAS THIS ARTICLE HELPFUL?

Not Helpful