LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Changed dependecy of a .NET DLL path after building exe

Solved!
Go to solution

I have LV2020.

I made a LVLIB that contains a class which methods are wrappers around a .NET DLL.

This DLL is placed inside a subfolder "DLL" (inside the folder of this LVLIB)

 

Then in another project, I have a Main.vi that uses this LVLIB.

So far so good.

 

When I build the exe into \Build folder, LabVIEW automatically copies that DLL into the build output folder (as expected). The exe works fine, pointing to the dll in its folder.

So far so good.

 

Now, if I close LabVIEW, re-open it, load the project (with Main.vi), I get a notification that the dependecy of the DLL was EXPECTED in \DLL BUT was loaded FROM the BUILD FOLDER.

 

It's like all my LVLIB re-linked into the copied DLL.

 

Also, if I rebuild the project, I get an error, because LV tries to copy the DLL into the output folder (ok) BUT the dll IS IN USE, so LV can't copy into a file that is somehow in memory.

 

Any idea why this happens?

 

thanks

0 Kudos
Message 1 of 4
(2,027 Views)

Is there a DLL in the build folder and not the DLL folder?  If not, I suspect you're reading the message backwards and it's saying it is looking in the build but finding it in the DLL.

In either event, the DLL is loaded into memory in your first steps.  When you close and restart things, it's no longer loaded so it has to look.

 

It has a relative path that it's looking for the DLL in.  If it doesn't find it there, it looks in a few other places.  If it finds it there, it loads from that place instead.

Are the relative paths from the exe and the vi the same?

0 Kudos
Message 2 of 4
(1,988 Views)
Solution
Accepted by Konan__

If you have your LVPROJ file in a directory, and that directory has a subdirectory containing your build folder, it will look in the build folder for DLLs and relink things there.  You need to move your LVPROJ file to a subdirectory that doesn't have a build folder in it.

 

For instance, if you currently have this:

 

C:\Code\Project.LVPROJ

C:\Code\Build\App.EXE

C:\Code\Build\Data\Whatever.DLL

 

Change it to this:

 

C:\Code\Project\Project.LVPROJ

C:\Code\Build\App.EXE

C:\Code\Build\Data\Whatever.DLL

0 Kudos
Message 3 of 4
(1,981 Views)

thanks.

 

It was the fact that I had the \build folder as subfolder of the project.

Now I understand why by default it's put outside.

0 Kudos
Message 4 of 4
(1,950 Views)