Example Code

RT EXE Versioning Example

Code and Documents

Attachment

Overview

Store the application version number in a constant and use a Pre-Build Action VI to automatically update it.

 

Pre-Build Action VI.png

 

Description

In a Real-Time Application build specification, Labview allow us to set a version number. But unfortunately the App.Version node doesn't work in the RTEXE and there is no other way to get our version number.

 

As a workaround, I use a constant named "AppVersion" in the top-level VI and i use a Pre-build Action VI in the build specification to automatically update the constant before each build.

 

In this example, the constant is a string but it can be changed easily with numeric values.

 

Hardware and Software Requirements

Labview with Application Builder.

 

Steps to Implement or Execute Code

Copy the Pre-Build Action VI in your project and add it as a Pre-build action in your Application Build Specification. 

 

Additional Information or References

 LabVIEW Real-Time Ideas : Add a version number to RT EXE files

Yohann L.

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

Comments
t.kendall
Member
Member
on

It should be noted that this will not work with LabVIEWCLI if you are using a CI server.  The workaround to that is to open the project with and invoke node from the path.  Make sure that you close it at the end or you will fail the build. 

 

 

Additionally I think that libraries are locked prior to the pre-build step so if the vi you are attempting to modify is part of a library you will get an error on save. 

Terry_ALE
Active Participant Active Participant
Active Participant
on

Has this been tried on LabVIEW FPGA?


Certified LabVIEW Architect, Certified Professional Instructor
ALE Consultants

Introduction to LabVIEW FPGA for RF, Radar, and Electronic Warfare Applications
DougFerguson
Member
Member
on

Really nice solution to a problem that shouldn't be. However it might be worth mentioning that I had issues finding the SringConstant when it was inside a CaseStructure. I am sure it would require doing a bit more digging down through the GObjects to find a StringConstant inside a structure. But this works simple and easy when the GObject of interest is directly on the diagram, outside of any structures.

Doug Ferguson

www.southerndaqsolutions.com
GIC-SAGM
Member
Member
on

The "pre build" vi is executed but I cannot do any debugging and nothing is updated on the front panel. Am I missing something here?

(I had a bit of difficulty and it would have been faster to find my errors if I could watch vi run or, at least, output something to FP)

21st November 1905: E=mc² - Physics would never be the same again...
Contributors