LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Application Builder over wrote my Main.vi with an example vi?

Solved!
Go to solution

I have been working on a project for a few months and was finally ready to build a standalone .exe through .lvproj application builder. 

For some reason, once the exe was built, it would not call my subs.  The main.vi would open and run but would not function properly.

 

I could clearly see the subs listed in the dependencies.  I made sure to move the subs into the always include category when the application was built.  I kept having issues with it so I would remove the exe from the project and start the process over again. In hopes to find what I was doing wrong. 

 

Unfortunately, Application Builder decided to over write my Main.vi (FF_Main.vi) with what looks to be a LabVIEW example file.  I did not create this and it appears to be the start of an Application Builder .vi example???.  I will attach it here. My original Main.vi was about 6MB+ and whatever this was overwritten with is 8kb.  All of my other sub vis are in tact. All of my other files are there, just my Main.vi was effected by this.  I can't even fathom how my Main.vi could be overwritten by a LabVIEW example file.  I assume this is an example file because it actually has notes on the block diagram. 

 

Is there any way to recover a project, a vi, revert back to a previous version, etc? I cannot spend another 3 months recreating this main.vi. 

If there isn't a solution, what is the best way to keep revision history in LabVIEW so I can revert back to a previously saved version of the development vi in the future?

 

No, I did not have a backup.

No, I do not work from a cloud.

The project was on a USB drive. -I used a recover utility (diskdrill, and others) and have recovered some files but the older version I recovered gives me an error code 13 (Hex 0xD) and cannot be opened, pasted in as a sub vi, or called upon.  I opened it up in notepad and it doesn't look like the same type of coding as when I opened up a sub.vi and compared them.  

Yes, I have learned my lesson. 

Yes, I am sick to my stomach. 

 

I am using 19.0.1f4 (64bit)

 

 

 

 

0 Kudos
Message 1 of 33
(1,035 Views)

Trying to retrace my steps in how this could have happened, I opened a blank project.  After selecting New ->Application (EXE), build exe, My Application Properties window comes up. 

 

Since I was having so many issues with the main not calling the subs, I decided to click on the pre/post build actions and preview the application before it was built to eliminate having to continuously start over.  

 

When I click on the Generate VI button, I see that another window "Save the generated VI (*.vi) file" shows that a Pre-Build Action.vi.  Sadly, this appears to be what overwrote my original code. 

 

Has anyone seen this happen?

0 Kudos
Message 2 of 33
(1,025 Views)

BrianK75_0-1659616101527.png

 

0 Kudos
Message 3 of 33
(1,023 Views)

Hi Brian,

 


@BrianK75 wrote:

Is there any way to recover a project, a vi, revert back to a previous version, etc? I cannot spend another 3 months recreating this main.vi. 

If there isn't a solution, what is the best way to keep revision history in LabVIEW so I can revert back to a previously saved version of the development vi in the future?

 

No, I did not have a backup.

No, I do not work from a cloud.


A German computer magazine offers stickers saying "No backup, no ruth…" 😄

 

To keep a revision history you should ALWAYS use some SCC tool (source code control)! Often used SCC tools are (Tortoise)SVN or GIT…

 

When there is no backup then there is no other way than recreating the missing code.

 


@BrianK75 wrote:

When I click on the Generate VI button, I see that another window "Save the generated VI (*.vi) file" shows that a Pre-Build Action.vi. Sadly, this appears to be what overwrote my original code.

 

Has anyone seen this happen?


The AppBuilder will not overwrite your MainVI on its own.

It will overwrite the MainVI when you select that specific VI filename in the file dialog that opens upon "Generate VI"…

 


@BrianK75 wrote:
My original Main.vi was about 6MB+ and whatever this was overwritten with is 8kb. 

This is not a good sign. Having a VI of more than 1MB in filesize should be quite uncommon!

(VIs can get that big when there are large images on the frontpanel or huge constants (or default values) in the VI…)

 


@BrianK75 wrote:

The project was on a USB drive.


This also in not recommended!

You should put your project on your local harddrive and use that USB drive only for backup purposes…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 33
(1,014 Views)

Sad to hear that you lost your 3-months of work. I guess that you had unknowingly selected the FF-Main.vi while it was asking to save the post/pre-build action VI and hence overwritten it, there is no way LabVIEW automatically overwrites something unless you tell it to.

 

Even for file recovery, it works for deleted files where the files are still present on the drive but their index entry has been removed from the file system, these file recovery software goes through every bit on the disk to match the known structure of data such as JPG and read them even without the index file. In your case, you may have overwritten the data (lost for good) or the file system chose to write the new file in a new location than the old one (there is a chance the recovery software can help).

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 5 of 33
(999 Views)

I think most of your problem originate from a complete misunderstanding of the application builder.

 

It is rare if dependencies are not correctly included. The option "always include" is typically only needed for subVIs that are loaded dynamically by name, certain custom dlls, custom help pages, etc.. Maybe we should investigate the cause for your original problems.

 


@BrianK75 wrote:

Trying to retrace my steps in how this could have happened, I opened a blank project.  After selecting New ->Application (EXE), build exe, My Application Properties window comes up. 

 

Since I was having so many issues with the main not calling the subs, I decided to click on the pre/post build actions and preview the application before it was built to eliminate having to continuously start over.  

 


To preview the build, go the the "preview" option below. Pre/post build actions are something completely different. They allow you to create an extra code that runs before or after the build process. Not what you want!

0 Kudos
Message 6 of 33
(977 Views)

You are correct GerdW.  It appears that I probably selected the name of my Main.vi as the Pre-Build.vi and....bam...Gone!

 

Most of my vis are in the 15-75kb range.  That one in particular had an image cut/pasted into the front panel (not set as background). It accounted for about 90% of the file size. 

 

0 Kudos
Message 7 of 33
(958 Views)

Santo_13

Unfortunately, I know way too much about data being overwritten and unrecoverable. 

0 Kudos
Message 8 of 33
(957 Views)

Altenbach, 

Obviously I have a complete and utter misconception of Application Builder.   I have used it many times before. Never ran into this. 

 

Once I have my code ready to convert into an executable, I only open my Main.vi, I select to create a project. That project pulls in all the dependencies (sub.vi s) in with it.  I add in my notes/read_me files to the project.  From there I click New-Application (EXE) .

I tell it what to name it and where to put it.  Done. 

 

Except when I ran the code, it didn't work. This is where my problem started. It was not calling my subs like it did when it was in development mode. So, for funsies, I thought, I will place all the subs and the main into the main vi section and ta-da...they all opened!  Only problem was they all opened at once. So, I went back to original config of how LVPROJ configures the files and started screwing around with pre/post....and here I am providing a lesson to others that I didn't want to learn. 

0 Kudos
Message 9 of 33
(953 Views)

@BrianK75 wrote:

Altenbach, 

Obviously I have a complete and utter misconception of Application Builder.   I have used it many times before. Never ran into this. 

 

Once I have my code ready to convert into an executable, I only open my Main.vi, I select to create a project. That project pulls in all the dependencies (sub.vi s) in with it.  I add in my notes/read_me files to the project.  From there I click New-Application (EXE) .

I tell it what to name it and where to put it.  Done. 

 

 


Hmmm... Maybe this is part of your issue? Here's my workflow for a new program.

 

  1. I create a new (empty) project
  2. I save the new and still empty project to a new directory in my source code directory 
  3. I set that directory to be auto-populating in the project
  4. I create a new VI and start programming
  5. I save my "main vi" to the project directory
    1. Sub vi's that are only part of this project are saved in a directory under the project
    2. Typedefs are saved in a directory under the project
    3. I might do more sub directories for larger projects if things get cluttered
  6. When I am ready to compile everything is there and nothing gets overwritten

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 10 of 33
(907 Views)