LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Best practice in getting VI Package Version

Solved!
Go to solution

Hi experts,

 

I need a way to get the vi package versions (i.e, v1.0.0.20) for some of my packages. I have many classes that are derived from a single class. Each subclass is packaged into vi package (*.vip) then distributed. When we instantiate these classes, I would like to have each subclass to tell the caller what version of vi package it is. 

 

There are several ways I can think of.. to achieve this. 

 

Solution 1) Use Pre-Build Action VI to store the version into a global. Then reads the global to get the version.

Solution 2) Use 'Edit All VI Description' option to add {version_number} then reads it through VI property. 

 

 

 

That being said, I really appreciate if someone can share any other way to achieve it more easily.

 

Thank you

SKTheLimit
0 Kudos
Message 1 of 3
(2,802 Views)
Solution
Accepted by topic author SKTheLimit

@SKTheLimit wrote:

 

Solution 2) Use 'Edit All VI Description' option to add {version_number} then reads it through VI property. 


That's how I do it.  We have a Pre Build VI that does many things and one is edit the VI Description.  I realize that pro has that option to edit VI descriptions but it is carried over from before I had pro.  Anyway it edits the VI description to have the following text added to every VI, control, class, and library.

 

-------------
Package Information

Product Name: XXX
Package File Name: XXX
Package Version: 2.0.1.15
Minimum LabVIEW Version: 17.0

 

The VI description can then be ready and package versions can be pulled.  If you don't like adding to the descriptions you could probably also just edit the class description.

Message 2 of 3
(2,793 Views)

Thank you Hooovahh,

 

Glad to hear my solution is a valid one. I'll proceed with it.

 

While I was exploring, I found this very useful particularly for my project. I can place this code at the base class, then any subclass will be automatically benefit as soon as inheriting from it. This code will pick the object class type then reads the vi description, followed by extracting the version information. You do not have to override this VI.

 

Screen Shot 2018-12-11 at 2.33.45 PM.png

 

SKTheLimit
0 Kudos
Message 3 of 3
(2,769 Views)