RanorexCore.dll and DllNotFoundException

Ask general questions here.
kimhauge
Posts: 2
Joined: Mon Jun 02, 2008 1:40 pm

RanorexCore.dll and DllNotFoundException

Post by kimhauge » Tue Jun 03, 2008 8:55 am

Hi. I have downloaded Ranorex evaluation version 1.4.0. I opened up the RanorexVS2005Sample2 project, compiled it and tried to run it in debug mode. I then got an DllNotFoundException:

Code: Select all

System.DllNotFoundException was unhandled
  Message="Unable to load DLL 'RanorexCore.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
  Source="RanorexNet"
  TypeName=""
  StackTrace:
       at Ranorex.NativeMethods.RxSetSleepTime(Int32 sleeptime)
       at Ranorex.Application.set_SleepTime(Int32 value)
       at RanorexVS2005Sample2.Class1.Main(String[] args) in C:\Program Files\Ranorex 1.4\Samples\RanorexVS2005Sample2\Class1.cs:line 47
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
Please also note that I get the very same type of exception when trying to insert code generated from the Ranorex Recorder into one of my Nunit tests....
But instead of getting it from:
Application.SleepTime = sleeptime;

I now get it from:
form = Application.FindFormClassName("OPOS");

Also note that I have tried to reference both the version from:
Net2.0-Pro-Debug\RanorexNet.dll
and
Net2.0-Pro\RanorexNet.dll

I do get the sample project specified to run if I run it in release mode, but I really can't use Ranorex if it doesn't allow me to run code in debug mode...

Is there a simple solution to this problem?

Best regards,
Kim

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Post by Support Team » Tue Jun 03, 2008 3:57 pm

As stated in the exception, the RanorexCore.dll is needed to execute Ranorex methods. That's why the RanorexCore.dll needs to be in the same directory as the application that calls Ranorex methods.

By default, the Release configuration of the Ranorex RanorexVS2005Sample2 builds the resulting exe to the Ranorex\bin\Net2.0 folder, whereas the Debug configuration builds to the Ranorex\bin\Net2.0-Debug folder. Please, change the "Output path" property in the Build properties page of the RanorexVS2005Sample2 project to point to the Ranorex\bin\Net2.0 folder.

When using NUnit, just put the RanorexCore.dll, RanorexNet.dll and RanorexSpy.dll into the folder where your NUnit test library is. You might also read this thread concerning NUnit and and Ranorex.

Regards,
Alex
Ranorex Support Team

kimhauge
Posts: 2
Joined: Mon Jun 02, 2008 1:40 pm

Post by kimhauge » Wed Jun 04, 2008 8:22 am

Thank you for your reply :D

Prior to writing the first post, I placed the following files in .\Common\lib\ (which also holds my nunit*.dll files):
RanorexCore.dll
RanorexNet.dll
RanorexSpy.dll

In my project from .\Common\test\NUnitTests I then referenced .\Common\lib\RanorexNet.dll and it all compiled just fine. During runtime it then gave me the exception I posted. I then copied RanorexCore.dll into my .\Common\test\NUnitTests\bin\debug directory and it still failed... and when the Sample I tried to run failed with the same error as well, I simply thought it was some error with the downloaded build or something :wink:

After reading your post I double-checked and I finally saw what I should have seen in the first place: In my haste I had copied RanorexCore.dll into the wrong \test\NUnitTests directory (we have that directory structure for client, service and common code) :roll:

So sorry for wasting your forum time :wink: Next time I will double-check again :D

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Post by Support Team » Wed Jun 04, 2008 9:15 am

kimhauge wrote:So sorry for wasting your forum time :wink:
That's okay, just buy a Ranorex license and everything's fine :wink:

Regards,
Alex
Ranorex Support Team