Accessing Pre and Post Build Action VI Names Programmatically in LabVIEW

Updated Jan 11, 2019

Reported In

Software

  • LabVIEW Base
  • LabVIEW Full
  • LabVIEW Professional

Operating System

  • Windows

Other

Windows 7

Issue Details

I'm working on a large LabVIEW project and my team and I use source control. We also have pre and post build action VIs in our built application that we need to ensure get sent as dependencies--is there a way to programmatically access the names of these VIs?

Solution

Yes, there is. The following example demonstrates how to retrieve the names of these actions.
  1. Open a project by using an invoke node with a path created by the Build Path VI, the Current VI Path constant, and the name of your project.
  2. Use a Project property node to open a reference to the Targets in the project.
  3. Use the Index Array VI to access the application you'd like to find the build action of. In this example, it was the first Target in the list.
  4. Use another property node to open a reference to Build Specs.
  5. Use another property node to open a reference to the Build Specification's Owned Items[]. Again, in this example, the needed item was the first in the output array.
  6. Last, use an Invoke Node method Get Tag to acquire the value of the requested tag.
    1. To get the TagName of the item you want to get the value of, use an Invoke Node with the method Get Tag Names and look through the output array for the corresponding tag. In this example, we're looking for the Pre-Build Action VI name, so the Tag is Bld_preActionVIID.
  7. Use the Variant to Data VI to convert the output to be used for a ProjectItem property node, and then choose VIReference as the property. 
  8. Lastly, use a VI Property node to retrieve the Name of the VI. 

Additional Information

To access other project information programmatically, you can use the Get Tags method to see the tag names of items in your project. Alternatively, open up your .lvproj file in your favorite word processor and view the XML tags there instead.