Determining the Version of an Executable Built with LabVIEWPrimary Software: LabVIEW Development Systems>>LabVIEW Professional Development SystemPrimary Software Version: 8.0 Primary Software Fixed Version: N/A Secondary Software: LabVIEW Toolkits>>Application Builder
Problem: 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 >\vi.lib\Platform folder in your National Instruments LabVIEW 8.6 folder on your computer. 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 FileMajorPart, FileMinorPart, FileBuildPart, and FilePrivatePart for the respective version parts. This property node also contains properties such as ProductName, InternalProductName, LegalCopyright, and all the attributes that you can set for an executable in the LabVIEW Application Builder. 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 and Application»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. Related Links: Microsoft Developer Network Microsoft Developer Network: FileVersionInfo Class (System.Diagnostics) LabVIEW 8.6 Help: Using .NET with LabVIEW NI Developer Zone Tutorial: .NET Support in LabVIEW 7 Express Attachments:
Report Date: 02/23/2006 Last Updated: 06/22/2009 Document ID: 3UM8JBUM |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
