Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Using LabVIEW Projects

LabVIEW 8.5 Help
August 2007

NI Part Number:
371361D-01

»View Product Info

Use projects to group together LabVIEW files and non-LabVIEW files, create build specifications, and deploy or download files to targets. When you save a project, LabVIEW creates a project file (.lvproj), which includes references to files in the project, configuration information, build information, deployment information, and so on.

You must use a project to build applications and shared libraries. You also must use a project to work with an RT, FPGA, PDA, Touch Panel, DSP, or embedded target. Refer to the specific module documentation for more information about using projects with these targets.

If you are using a project with an NI device driver, refer to the specific driver documentation for more information about using projects with drivers.

Project Explorer Window

Use the Project Explorer window to create and edit LabVIEW projects. Select File»New Project to display the Project Explorer window. You also can select Project»New Project or select Empty Project in the New dialog box to display the Project Explorer window.

The Project Explorer window includes two pages, the Items page and the Files page. The Items page displays the project items as they exist in the project tree. The Files page displays the project items that have a corresponding file on disk. You can organize filenames and folders on this page. Project operations on the Files page both reflect and update the contents on disk. You can switch from one page to the other by right-clicking a folder or item under a target and selecting Show in Items View or Show in Files View from the shortcut menu.

The Project Explorer window includes the following items by default:

  • Project root—Contains all other items in the Project Explorer window. This label on the project root includes the filename for the project.

You can hide the Dependencies and Build Specifications items in the Project Explorer window. If you hide either item you must display it again to access the item; for example, to build an application or shared library.

When you add another target to the project, LabVIEW creates an additional item in the Project Explorer window to represent the target. Each target also includes Dependencies and Build Specifications. You can add files under each target.

You can place a VI from the Project Explorer window on the block diagram of another open VI. Select the VI you want to use as a subVI from the Project Explorer window, and drag it to the block diagram of the other VI.

You also can use the Project properties and methods to configure and modify projects and the Project Explorer window programmatically.

Using Folders in LabVIEW Projects

You can add two types of folders to a LabVIEW project, virtual folders and auto-populating folders. Virtual folders organize project items. Right-click a target and select Add»Folder (Snapshot) from the shortcut menu to add a virtual folder to the project. Auto-populating folders update in real time to reflect the contents of folders on disk. Add an auto-populating folder to the project to view project items as they appear on disk. Contents of an auto-populating folder do not always match disk contents exactly in the case of project libraries. The Items page of the project displays project library (.lvlib) contents by library hierarchy and not by disk organization. For example, if a VI exists in a library file, the VI appears in the project under the library file. The VI does not appear in the project in the location on disk.

Auto-populating folders are visible only on the Items page of the Project Explorer window. You can view the disk contents of an auto-populating folder but you cannot perform disk operations such as renaming, reorganizing, and removing project items. To perform disk operations of items in an auto-populating folder, use the Files page of the Project Explorer window. The Files page displays the location of project folders on disk. Project operations on the Files page both update and reflect the contents of the folder on disk. Likewise, LabVIEW automatically updates the auto-populating folder in the project if you make changes to the folder on disk outside of LabVIEW.

The advantage of performing file operations on the Files page instead of using the file system outside of LabVIEW is that LabVIEW can update referencing files. When you move, remove, or rename items on the Files page, LabVIEW updates all referencing items to reflect the change. Performing file operations on the Files page is especially useful for rename operations. If a project is open and you rename a file on disk that is in an auto-populating folder, LabVIEW detects the change and the Undo File Rename dialog box appears. You can either revert the rename operation or continue with the operation. However, items in the project that reference that file do not reference the new name and might result in conflicts because the rename occurred outside of LabVIEW.

An auto-populating folder can contain a virtual folder only if the virtual folder is within a library hierarchy. A virtual folder does not represent files on disk. You can convert an existing virtual folder to an auto-populating folder by right-clicking a virtual folder on the Items page and selecting Convert to Auto-populating Folder from the shortcut menu. A file dialog appears prompting you to select a folder on disk. LabVIEW automatically renames the virtual folder to match the folder on disk and adds all contents of the folder on disk to the project. Items in the virtual folder that do not exist in the directory on disk move to the target.

To disable auto-population, right-click an auto-populating folder and select Stop Auto-populating from the shortcut menu. The auto-populating folder becomes a virtual folder.

Note  Auto-populating folders can contain virtual items such as variables and hyperlinks because these items do not have a corresponding item on disk. You can rearrange virtual items such as variables and hyperlinks within an auto-populating folder because the movement does not result in a movement on disk. You also can move virtual items into and out of auto-populating folders.

Resolving Project Conflicts

Projects can contain items that conflict with other items in the project. A conflict is a potential cross-link that occurs when LabVIEW tries to load a VI that has the same qualified name as an item already in the project. A cross-link occurs when a VI calls a subVI at the incorrect path. For example, a VI calls an open subVI of the same qualified name as an item already in the project from a different path. Most conflicts exist because other items in the project reference a conflicting item. Removing a conflicting subVI from the project might not resolve the conflict because other VIs in the project may still reference the conflicting subVI.

Tip  Change the qualified name of a conflicting item by adding it to a LabVIEW project library. When a VI is part of a project library, LabVIEW qualifies the VI name with the project library name to avoid cross-linking. A qualified name includes the filename and the qualified name of the owning project library filename. The qualified name changes without changing the path or filename.

A yellow warning triangle appears on any conflicting items in the Project Explorer window.

The best way to determine if cross-linking exists is to view the full path to the item. Right-click the project root and select View»Full Paths from the shortcut menu to display the Paths column and view the file paths that correspond to the project items. You either must rename or remove all but one item with the same qualified name from the project. To view detailed information about existing conflicts, click the Resolve Conflicts button to display the Resolve Project Conflicts dialog box. You also can select Project»Resolve Conflicts from the project menu to display this dialog box or right-click a conflicting item and select Resolve Conflicts from the shortcut menu.

You can right-click a specific conflicting item on the Items page and select Find»Conflicts to view all conflicting items in the Find Conflicts dialog box. If the item only conflicts with one other item, LabVIEW highlights the item in the Project Explorer window. You also can use the Find:Conflicts property to find conflicts in the project programmatically.

When two or more items have the same qualified name, and only one item exists on disk, you can right-click a conflicting item and select Replace with Item Found by Project from the shortcut menu. LabVIEW updates the callers of the incorrect item to reference the item found on disk. If you do not want to remove the conflicting item and you detect it has the same qualified name as another item in the project, you can rename the item or add the item to a project library. Renaming the item loads the callers that reference the incorrect item path, renames the item, and saves the item and all callers. The callers reference the new name. If you do not save the callers, the original item appears under Dependencies because callers still reference the item.

If you detect that one or more VIs incorrectly refers to the wrong subVI, redirect all callers to reference a subVI with a different path. Right-click a conflicting VI in the Project Explorer window and select Replace with from the shortcut menu to choose the correct subVI on disk. Select a replacement file from the file dialog that appears. LabVIEW automatically updates all items that reference the incorrect path to reference the replacement. You also can load each VI that refers to a conflicting item. The Resolve Load Conflict dialog box appears. You can choose a specific caller VI to load.

Note  LabVIEW dims Replace with Item Found by Project and Replace with if the item is a project library or a member of a project library.

You can remove caller VIs from the project to resolve conflicts when a hierarchy of VIs conflicts with the hierarchy of other contents in the project. Right-click a VI or type definition and select Find»Callers or Find»SubVIs from the shortcut menu to highlight the caller or subVI the item references in the Project Explorer window. If more than one caller or subVI exists in the project, the Find Callers or Find SubVIs dialog box appears. Right-click a project root or target and select Find Items with No Callers from the shortcut menu to display the Find items with No Callers dialog box and find all top-level items. If no callers reference a conflicting subVI, remove the subVI from the project. You also can use the Find:Callers, Find:SubVIs, or Find:Items with No Callers properties to find callers, subVIs, and items with no callers programmatically.

If a LabVIEW project library in memory conflicts with another project item, you must rename at least one conflicting library before loading. Right-click the library and select Unload from the shortcut menu. After LabVIEW unloads the library, you can reload the library and the VIs from the correct paths. If a library conflicts with another project item and is not in memory, you can right-click the library and select Load from the shortcut menu. After LabVIEW loads the library, you can edit the library or its contents and load VIs from the correct paths.

To help prevent conflicts, LabVIEW automatically tracks the hierarchy of every item you include in the project. For example, when you open a VI, LabVIEW adds all members of the VI hierarchy to a folder titled Items in Memory under Dependencies. When an item is not in the project but another item in the project is dependent on the missing item, the missing item appears in Dependencies. Dependencies updates when you add, remove, or save an item in the project. The Hierarchy Conflicts with Project dialog box appears when you try to load a file that conflicts with items already in the LabVIEW project. LabVIEW cannot open the file because items in its hierarchy have the same qualified name as items in the project or Dependencies. If a dependent item conflicts with another project item, removing the items that reference it removes the item from Dependencies.

LabVIEW also scans the VI hierarchy when you open the block diagram of a VI and add a new subVI. The subVI does not load if any members of its hierarchy have the same qualified name but different paths as an item already in the project. The Add to Project and Update Dependencies dialog box appears. You can add the hierarchy or cancel the load and choose another subVI.

Note  Deleting an item that has callers from the project moves the item to Dependencies. The item is a conflicting item until you remove all callers that call the conflicting item from the project.

Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit