cancel
Showing results for 
Search instead for 
Did you mean: 

Use Version Information from Build Specification in code

SOLVED
HolgerN
Member
Solved!

Use Version Information from Build Specification in code

Message contains an attachment

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.

12 REPLIES 12
billko
Proven Zealot

Re: Use Version Information from Build Specification in code

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.
cbutcher
Trusted Enthusiast

Re: Use Version Information from Build Specification in code

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
Kyle97330
Trusted Enthusiast

Re: Use Version Information from Build Specification in code

Message contains a hyperlink Message contains an image Message contains an attachment

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

drjdpowell
Trusted Enthusiast

Re: Use Version Information from Build Specification in code

I also use the EXE file version.

HolgerN
Member
Solution

Re: Use Version Information from Build Specification in code

Message contains an image Message contains an attachment

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

 

 

labviewAnmerkung 2020-03-27 071030.JPG

drjdpowell
Trusted Enthusiast

Re: Use Version Information from Build Specification in code

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

crossrulz
Knight of NI

Re: Use Version Information from Build Specification in code

Message contains an image Message contains an attachment

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.



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
billko
Proven Zealot

Re: Use Version Information from Build Specification in code

Message contains an image

@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.
Kevin_Price
Proven Zealot

Re: Use Version Information from Build Specification in code

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

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.