LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to include .xml file while building a stand alone application .exe file from a Labview program

HI,

 

I have a labview program which loads default values of all the variables from a .xml file when executed.  I am trying to build a standalone '.exe application'  using

(Tools Menu --> Build Application from VI) , however I am not sure where to include this .xml file in the process?  I really appreciate if some one could let me know.

 

Thanks

Vish

0 Kudos
Message 1 of 13
(5,648 Views)

That depends on the LV Version you are using.

0 Kudos
Message 2 of 13
(5,637 Views)

Perhaps you could write your program to build the XML file if it doesnt exist. You could assign default values to everything.

 

Right now, what happens if the program starts and the XML file doesnt exist?

0 Kudos
Message 3 of 13
(5,630 Views)

I am using Labview 2010 version. Right now the program is throwing me error that "NICON_CONFIG.xml file is not found in the application.exe folder", however we cannot create a folder with .exe extension.  I believe somehow this has to be included during the build of .exe application from the labview program.  I have attached a screen shot of the error and the xml file. I am loading all the variable values in the labview program from this file.  

 

I didn't get what do you mean by  'program to create xml file', do you mean write a code to create the xml file and include that in the application dependencies? If I do that does it create the file in the same folder?  Also please let me know if you have further suggestions.  

 

Thanks

Vish

Download All
0 Kudos
Message 4 of 13
(5,622 Views)

I have changed the xml file extension to '.txt' as this website is not supporting .xml file upload. 

 

 

0 Kudos
Message 5 of 13
(5,621 Views)

Hi vish,

 

in LV2010 the recommended way to build an executable is to create a build specification in the project explorer.

That way it is easy to define additional files (even your xml) to be included in the executable's data folder...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 13
(5,617 Views)
Sorry, I misunderstood.

I thought you were using an XML file to store program options and such.

My mistake.
0 Kudos
Message 7 of 13
(5,612 Views)

As GerdW said, it is preferable (and better practice) to use the project explorer. My guess, you didn't configure the build correctly (and probably used the default settings).

 

First, you have to specify your xml file as Always included is the source file tab

 

Build1.png

 

Now look at how the build folders are built:

 

Build2.png Build3.png

 

The .ini file (xml in your case) is in the data folder. So in the build the relative position of the xml file is not the same as in the development environment. You have to be aware of this difference and use a diiferent relative path for the exe. You can do this using a conditional disable symbol in the project and then use the conditional disable structure in your VI.

 

PathInVI.png

 

Here in the deploy case the exe will look for the file in the data folder and in the development environment it will look in a folder name Files.

 

Ben64

 

 

Message 8 of 13
(5,596 Views)

HI Ben,

 

Thanks for the reply. I appreciate the difference in the paths.

For example in my case the .exe file uses "C:\Users\ViswanathKammula\Desktop\NICON_Application\builds\NICON_wrkng_modified_ver1\NICON_wrkng_modified_ver1'  where as the  suppport directory uses

C:\Users\Viswanath Kammula\Desktop\NICON_Application\builds\NICON_wrkng_modified_ver1\NICON_wrkng_modified_ver1\data

 

I really couldn't get the part of your reply "using a conditional disable symbol in the project and then use the conditional disable structure in your VI".  I went to project settings and tried something (see attached screen shot), however I am really not sure where to include the VI above in my current program and how does it affect the working of my code. I really appreciate if you could elaborate.  Thanks in advance.

 

Vish 

0 Kudos
Message 9 of 13
(5,563 Views)

In the project window right-clic on the project name and select "properties"

 

ProjectView005.png

 

 

Select "Conditional Disable Symbols", write "DEPLOY" in New Symbol and "FALSE" in New Value and press "ADD"

 

ProjectView006.png

 

In your block diagram add a conditional disable structure from the structures palette. Right-click on the structure and select "Edit condition for this subdiagram ..."

 

In the configure condition window set the symbol to "DEPLOY" and the value to "FALSE" for the path for the development environment. Add a subdiagram for the condition DEPLOY = TRUE to set the path for the executable.

 

ProjectView007.png

 

 

 

When you develop set the value of deploy to FALSE from the project window (first picture in this post). Before creating the executable change the value to TRUE.

 

Ben64

Message 10 of 13
(5,547 Views)