From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Get Real-Time Executable Version Information

Code and Documents

Attachment

Overview

The following code with allow you to retrieve the version number of your real-time executable if your real-time executable was deployed using a component definition file.

Description

When you build your real-time executable, there is an option in the Real-Time Application Properties dialog box in the Component Definition Category to "Create a component definition file (.cdf) and specify dependencies." Creating this file allows you to deploy the real-time application using MAX or the LabVIEW System Configuration API. Within this dialog box you can also choose how to represent the version number. You can choose to manually specify the version number each time you build the application or you can choose to let LabVIEW Auto increment the version number each time you build. Thus, the first time you build the application, the version number will be 1.0.0.0 and the next time you build it, it may be 1.0.0.1 (indicating that this is the second build but there weren't any major changes made).

Keeping track of the versions can be very useful as you develop and change your code. Finding out what version of the code is running on your target may be important in understanding why the code is functioning a certain way or in determining whether or not the code needs to be redeployed.

This example VI simply parses the configuration definition file, config.cdf, located in the c:\ni-rt\system\ directory of the Real-Time target and grabs the version information.

GetRTexeVersionNumber.png

Steps to Execute Code

  1. Create a real-time application
    1. Within the My Real-Time Application Properties dialog box, select Component Definition in the Categories list.
    2. Place a check mark next to "Create a component definition file (.cdf) and specify dependencies."
    3. Select your desired settings under Version Number and Required Software Components.
    4. Select Build.
  2. Deploy your real-time application from MAX.
    1. In MAX, under your real-time target, right-click Software and select Add/Remove Software.
    2. Select Install the following startup application: and choose your real-time application.
    3. Continue with the wizard to install the application.
  3. Run the attached VI, Check RTEXE Version Number_LV 2011.vi , on your target to retrieve the version number.

Requirements

Software

LabVIEW 2011 or later

LabVIEW Real-Time Module 2011 or later

Hardware

A real-time target

**This document has been updated to meet the current required format for the NI Code Exchange. For more details visit this discussion thread**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Call_Me_Vinny
Member
Member
on

Why don't you simply use the INI VIs to read the token instead of parsing the entire file?

Chris
Project Engineer
Certified LabVIEW Architect
Certified TestStand Architect
DamienGaudry
Member
Member
on

Any idea where this file lives on the Linux cRIOs (cRIO-9066)?

Alisha_P
Active Participant
Active Participant
on

Damien, check here: /etc/natinst/share

(I'm looking at it on a 9031 but I would expect it to be the same)

DamienGaudry
Member
Member
on

Thanks for the quick response Alisha!

Contributors