LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to programmatically build applications in a usable way

Solved!
Go to solution

We have about 10 projects with each at least 1 build definitions, building these manually is tedious.

Looking into automating this I came across http://www.ni.com/example/30051/en/. This has two problems making it not really usable:

 

  •  it uses application arguments, so you invoke it like LabVIEW.exe programmaticbuild.vi -- my.lvproj, but suppose you have labview already running and use that command it will pass the arguments of the already running instance
  •  to counter that I made a standalone application from programmaticbuild.vi, however that fails with
    Error Code: 1025
    Error Source: Open VI Reference in NI_App_Builder_API.lvlib:Build (path).vi->BuildTargetBuildSpecification.vi->programmaticbuild.vi

 

Ideally a solution to the second problem would be ideal, however a nice way around the first one would already be a good start. Any ideas? Thanks!

0 Kudos
Message 1 of 7
(5,453 Views)
If you already have LabVIEW running, you can use VI Scripting functionality to invoke a build from a build specification. Scripting allows you to automate a lot of functionality from LabVIEW (even things thing wiring up terminals!).

For the second error - there isn't enough information in your post to figure out what's going wrong - maybe a path issue? Can you post a simplified version of your project/files that replicates the error?

LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 7
(5,430 Views)

This article from our friends at JKI is old, but still good - http://blog.jki.net/jki/can-you-build-your-application-in-one-click/

 

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 3 of 7
(5,419 Views)

@SamSharp I've attached the programmaticbuild.vi, only slightly modified from the original, and a project which just creates a standalone application from it.

Called from the commandline like ProgrammaticBuild.exe /path/to/my.lvproj, the generated logfile contains

 

ProgrammaticBuild
/path/to/my.lvproj
/path/to/my.lvproj was unsuccessful for build.  Error Code: 1025   Error Source: Open VI Reference in NI_App_Builder_API.lvlib:Build (path).vi->BuildTargetBuildSpecification.vi->programmaticbuild.vi<APPEND>
VI Path: <b>_bin\vi.lib\AppBuilder\BuildTarget.vi</b>

 

I don't know for which vi the 'Open VI Reference' error is

 

The exact same command works when ran through labview, i.e. if I call  "C:\Program Files (x86)\National Instruments\LabVIEW 2013\LabVIEW.exe" programmaticbuild.vi -- /path/to/my.lvproj the logfile has

 

LabVIEW
/path/to/my.lvproj
/path/to/my.lvproj was built successfully.

 

@Jim interesting but it also uses BuildTargetBuildSpecification.vi, so will probably generate the same error I'm facing now

Download All
0 Kudos
Message 4 of 7
(5,412 Views)
Solution
Accepted by Stijn
By definition your second option won't work because one of the things stripped out of a standalone executable is the ability to compile code.

In terms of option 1, the issue is whether the list of command line parameters would get updated with additional "launches". I don't know if it would, but I never tried it either...

The utility I wrote just asks for a project name when it starts.

Do you do this a lot? It might be worthwhile to create a sort of build server that automatically rebuilds things after any changes to a predefined list of projects.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 5 of 7
(5,408 Views)

@mikeporter wrote:
one of the things stripped out of a standalone executable is the ability to compile code.


 

Aha, that explains a lot.

 

We're planning to make building of our Labview projects part of a continuous integration, so yes we're going to build them often.

 

Another workaround for option 1 would be to write the projects to build to a file which is then read by the vi.

 

But the idea of a 'server' application which builds is probably the most viable. Thanks!

0 Kudos
Message 6 of 7
(5,399 Views)
The thing is, as a practical matter the server would likely need to run on a separate computer since building executables consumes all of an instance's time.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 7 of 7
(5,392 Views)