From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Build Application Programmatically using LabVIEW

Code and Documents

Attachment

Overview

This example shows how to batch build several distributions in LabVIEW using a programmatic build process.

 

Description

Many applications require frequent compilation into an executable (.exe) or a dynamic link library (.dll). An application might require building the source code into an executable every night or every ten minutes. Prior to LabVIEW 8.0 the application builder required the creation of a unique *.bld file to correspond to every configuration your application required. You could then call that file from a batch file.

 

When the LabVIEW project was introduced in LabVIEW 8.0, build specifications were integrated into the project. To provide the previous capability of batch compilation, LabVIEW now provides a VI called BuildTargetBuildSpecification.vi that programmatically builds a distribution using a predefined build specification. This example shows how to use that feature to batch build applications from the command line. This enables you to build applications from a task automation program such as Windows Task Scheduler.

 

The example programmaticbuild.vi shows how to programmatically build several projects using command line arguments.  Using the BuildTargetBuildSpecification.vi (which is packaged with the LabVIEW Application Builder), this example simply iterates through the command line arguments and uses BuildTargetBuildSpecification.vi as a subVI to build projects according to their specified build specifications.  Any LabVIEW version 8.0 or later with Application Builder installed has this function available in <LabVIEW directory>\vi.lib\AppBuilder.

 

Also see http://zone.ni.com/devzone/cda/epd/p/id/5051

 

 

Steps to Implement

  1. Open a command line window.
  2. Browse to the LabVIEW directory, and enter the following line in the command line window:

 

               labview.exe “<Location of programmaticbuild.vi>” -- “<Project 1>.lvproj” “<Project 2>.lvproj” “<Project 3>.lvproj” <…> “<Project n>.lvproj”

 

This example is configured to run automatically when the VI opens so that the projects can be built from the command line window. You can implement this process into any batch processing system that is set up (such as Windows Task Scheduler) by configuring the batch program to call labview.exe with the previous arguments.

 

This example include a built-in error logger that writes the file error_log.txt to the temporary directory specified in the Options dialog box. This log displays information about the build process. Select Tools»Options to display the Options dialog box, and select Paths from the Categorylist to configure the temporary directory. You can edit the build process used in this example. Additionally, the example contains a sequence structure that closes LabVIEW when the VI finishes executing, depending on the value of the Boolean constant.

 

Requirements

LabVIEW 8.0 or later

 

VI Snippet

programmaticbuild.png

 

**This doucment has been updated to meet the current required format for the NI Code Exchange. For more details visit this discussion thread.**

John Passiak

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
beuvink
Member
Member
on

This example explains how to automatically build applications. Once you get to this stage this example is all you need. Unfortunatly the BuildTargetBuildSpecification on which it is based only reports errors and no warnings. As it is protected by a password it is not possible to change this or make one yourself.

---

25+ years long fan of LabVIEW. Be aware that NI changed their business model with great impact .
Senthil_Prakash
Member
Member
on

It works good with LabVIEW but This application is not working in Built Application

Senthil Prakash S
Certified LabVIEW Associate Developer
HaBoRocks
Member
Member
on

This approach launches LabVIEW application, I want the build to run without launching LabVIEW IDE.

If I run the command it should just Build the project and save the EXE and INSTALLERs at respective paths. Is it doable?

Vipin@FR
Member
Member
on

is it possible to get a console output from this VI to know the build is failed or successful.