0

I am working on a project to make a client program to connect CNC FANUC machine with a personal computer and collect several data using FOCAS library.

After downloading FOCAS library with several dll files and a focas library C# file, I tried to create a program to get the data from the machine based on the instruction of functions in FOCAS library (https://www.inventcom.net/fanuc-focas-library/general/fwlib32).

However, whenever I execute the program, I always face the error saying that "Unhandled exception. System.DllNotFoundException: Unable to load DLL 'FOCAS32.dll' or one of its dependencies(0x8007007E)". I searched on the Google and stackoverflow questions list but nothing has been working.

Could you tell me how to solve this problem?

To elaborate the situation, I made a solution called "FanucCNCDataAcquisition.sln" by using Visual Studio 2019 and I stored two projects: one is FOCASLibrary which has a Focas32.cs for the library purpose and the other is DataAcquisition which has a program.cs for execution with the reference on the focas library. I downloaded several .dll files including FOCAS32.dll and those are not in the same directory with the solution so I am curious if the cause of the problem is based on the location of the files.

sol
  • 13
  • 5

3 Answers3

0

You need to reference the DLL within the solution, i'll show you in the steps below: (My visual studio is in Portuguese but you can follow these steps with English) First, you right-click on "References" and click "Add Reference" enter image description here

In this window you are going to click "Search" and add your DLL manually enter image description here After that, all the classes and methods within this library will be available for you to use, you just go to the oficial documentation and look for code examples.

0

You do not need to import the dll file as a reference. You should add the .cs extension library file to your project and copy the dll files to the place where the application will run.

-1

I tried the solution above but failed. Below are some other solutions I found.

  • The .dll files should be put in the debug folder, so you can just have a copy there.
  • Here's another solution in this article says that putting the .dll files under the C:\Windows\System32 folder should work, I tried and it did work.
caaat
  • 1
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 24 '22 at 13:16