Page 1 of 1

KMotion_dotNet.dll not found

Posted: Tue May 07, 2024 4:19 pm
by TrayJohnson
Greetings. I need your help. I wrote C# windows forms application, and it works fine on PC with Windows 10 and Visual Studio 2022. Now I copied entire Kmotion 5.0.7 folder (where my project is also located) and pasted it on laptop which also has Windows 10 and Visual Studio 2022. Now when I try to

Code: Select all

 _Controller = new KMotion_dotNet.KM_Controller();
I have an exception

Code: Select all

KMotion_dotNet.DMException: 'Dll Not Found Exception thrown :  Caller - [KMotion_dotNet.KM_Controller] :: Member - [KM_Controller]'
. In details of my exception I see:

Code: Select all

InnerException	{"Unable to load DLL 'KMotion_dotNet_Interop.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"}	System.Exception {System.DllNotFoundException}    
In solution explorer -> References, the path to Kmotion_dotNet seems correct. (the reference is set to KMotion5.0.7\KMotion\Debug and on PC it works fine. When I tried to add reference to KMotion_dotNet_Interop.dll it said reference could not be added. Tried the same on PC and it also said it could not be added, yet on PC all works fine. Can you give me an advice??

Re: KMotion_dotNet.dll not found

Posted: Tue May 07, 2024 5:23 pm
by TomKerekes
Hi Tray,

Maybe the required version of .NET is missing on the PC? Does the example SimpleFormsCS run?

You might read this Thread.

Re: KMotion_dotNet.dll not found

Posted: Tue May 07, 2024 7:41 pm
by TrayJohnson
It seems that I am unable to launch SimpleFormsCS as well, the same error. I try it on Visual Studio 2022 17.9.6. When I first open solution of the example you provided, namely SimpleFormsCS, it asks me to migrate to newer version of visual studio something like that, and then gives me the migration report. In properties it says the target framework is .NET Framework 4.8. As I now remember, on PC I had the same problems, when I tried to add reference to Kmotion_dotNet.dll on newly created projects, but on my PC SimpleFormsCS worked (on laptop even SimpleFormsCS doesn't work), so I basically remade your example project from the scratch. And now when I copy the same project to my laptop, it again has this error. I will try things recommended on the thread you linked me. If you have more recommendations for me based on information I provided you above, I would greatly appriciate it.

Re: KMotion_dotNet.dll not found

Posted: Wed May 08, 2024 11:02 am
by TrayJohnson
Okay, after rebuilding the libraries with BuildAllLabs.sln, and for now, my projects seems to be working fine on laptop. I guess I should have tried to do that before writing on forum, I got confused because on my PC I did manage to make it all work without rebuilding, so I didn't know rebuilding was necessary. Anyway, thanks for the help. I will ask more questions if some problems occur later.

P.S. Is there some documentation regarding using KMotion_dotNet.dll in C# like what functions are there and how are they used ? I only saw examples which is fine, but I think it may be useful to have some documentation as well.

Re: KMotion_dotNet.dll not found

Posted: Wed May 08, 2024 7:50 pm
by TomKerekes
Hi Tray,

The .NET documentation is on-line here.