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.
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...
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).
I also use the EXE file version.
I don't believe your solution will work in a built EXE. The EXE file version technique will work.
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.

@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.
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