From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Use Version Information from Build Specification in code

Solved!
Go to solution

Hello,

I want to use the version information from the build specification in my application instead of the hard-coded string (2.0.6 in the attached image). But I have no idea how to get the data in my code.

0 Kudos
Message 1 of 13
(2,527 Views)

No matter what they say, Google is your friend.  😉

 

I Googled labview build revision in code and came up with a lot of good hits, and many different ways, depending on what, specifically, your need is...

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 13
(2,514 Views)

In your other thread, Ulib claimed you can use "[VersionNumber]" in the path.

Does that not work for you?

 

At least in preview, "C:\Users\<cb>\builds\Untitled Project 1_[VersionNumber]\My Application" looks promising to me.


GCentral
0 Kudos
Message 3 of 13
(2,485 Views)

If you are building the EXE and want to use the version that LabVIEW embeds in it, you can use the GetVersionInfo .NET command (passing the path and filename of the EXE into it).

 

EXE version.png

Message 4 of 13
(2,482 Views)

I also use the EXE file version.

0 Kudos
Message 5 of 13
(2,456 Views)
Solution
Accepted by HolgerN

I found the attached VI in the internet. That fits my needs very well.

 

 

labviewAnmerkung 2020-03-27 071030.JPG

0 Kudos
Message 6 of 13
(2,438 Views)

I don't believe your solution will work in a built EXE.  The EXE file version technique will work.

0 Kudos
Message 7 of 13
(2,419 Views)

There is a "hidden gem" that can be revealed with Darren's "Hidden Gems in vi.lib" package using VIPM.  This particular gem is FileVersionInfo.vi.  It looks like it will do what you are asking.  If you don't want to install the package, the VI is located at <LabVIEW>\vi.lib\Platform\fileVersionInfo.llb\FileVersionInfo.vi.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 13
(2,372 Views)

@crossrulz wrote:

There is a "hidden gem" that can be revealed with Darren's "Hidden Gems in vi.lib" package using VIPM.  This particular gem is FileVersionInfo.vi.  It looks like it will do what you are asking.  If you don't want to install the package, the VI is located at <LabVIEW>\vi.lib\Platform\fileVersionInfo.llb\FileVersionInfo.vi.


So that's where that VI resides.  I've used it before and wanted to recommend it, but I couldn't remember where it came from.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 13
(2,362 Views)

I dug into the "hidden gem" version a little because the pure .NET version shown in msg #4 has a small flaw (arguably) that I've run into before.  When both the Patch and Build values are 0 in the executable, the .NET string output truncates them away.  So if you built up a version "1.0.0.0" in the build spec, the string output would be "1.0".

 

The "hidden gem" version appears to me to avoid this flaw as does the visible dev environment code shown in msg #6.  Both seem to build up a string from the individual integers for Major,Minor,Patch,Build so there won't be any truncation.  My guess is that the "hidden gem" version might support non-Windows platforms where the .NET version wouldn't.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 10 of 13
(2,355 Views)