From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
03-26-2020 08:51 AM
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.
Solved! Go to Solution.
03-26-2020 09:00 AM
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...
03-26-2020 11:37 AM
03-26-2020 11:47 AM
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).
03-26-2020 02:33 PM
I also use the EXE file version.
03-27-2020 01:11 AM
I found the attached VI in the internet. That fits my needs very well.
03-27-2020 04:34 AM
I don't believe your solution will work in a built EXE. The EXE file version technique will work.
03-28-2020 07:11 AM - edited 03-28-2020 07:12 AM
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.
03-28-2020 10:43 AM
@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.
03-28-2020 11:40 AM
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