annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

Use Version Information from Build Specification in code

Risolto!
Vai alla soluzione

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
Messaggio 1 di 13
3.815Visualizzazioni

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
Messaggio 2 di 13
3.802Visualizzazioni

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
Messaggio 3 di 13
3.773Visualizzazioni

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

Messaggio 4 di 13
3.770Visualizzazioni

I also use the EXE file version.

0 Kudos
Messaggio 5 di 13
3.744Visualizzazioni
Soluzione
Accettato da autore argomento HolgerN

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

 

 

labviewAnmerkung 2020-03-27 071030.JPG

0 Kudos
Messaggio 6 di 13
3.726Visualizzazioni

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

0 Kudos
Messaggio 7 di 13
3.707Visualizzazioni

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
Messaggio 8 di 13
3.660Visualizzazioni

@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
Messaggio 9 di 13
3.650Visualizzazioni

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.
0 Kudos
Messaggio 10 di 13
3.643Visualizzazioni