Unable to load DLL - Why ??

Hi,

I created a simple C# program that imports a dll (Unmanaged dll), which a coworker wrote, the dll references
other managed dll's. On the PC i built the app on everything works great ( /bin/Debug/test.exe Folder), as well the unmanaged dll resides in the same folder as the .exe.


I published the app and ran it on another PC and i receive an error " Unable to load DLL "DSVR.dll" ..." Details

************** Exception Text **************
System.DllNotFoundException: Unable to load DLL 'DSVR.dll': This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)
at DSVR_CSharpExample.DSVR.DSVR_Open()
at DSVR_CSharpExample.Form1.Form1_Load(Object sender, EventArgs e) in C:Program FilesH&EDSVR_CSharpExampleForm1.cs:line 127
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)



I installed the same version of .net, Redistribution 2008 SP1, Powerpacks, etc.. i ran dependency walker and everything traced out fine.


Any Suggestion on What am i doing wrong (I've been trying to figure this out for 2 days) ?





[code]
amespace DSVR_CSharpExample
{

///
/// Static class containing all of the exported methods from the DSVR library
///
public static class DSVR
{
[DllImport("DSVR.dll", EntryPoint = "DSVR_Open")]
public static extern IntPtr DSVR_Open();

[DllImport("DSVR.dll", EntryPoint = "DSVR_Close")]
public static extern void DSVR_Close(IntPtr ConnectionHandle);

.
.
.
.


[/code]


Much appreciated,

Matt

Comments

  • Make sure the unmanaged DLL does not, in fact, have any dependencies that maybe your visual studio install is providing.

    I think your .NET compiler will not consider this when publishing.

    ><//~Psightoplasm`~
  • [color=Blue]Check the options the DLL was created with. By default, a project uses options to use the run-time libraries (DLLs) provided by the compiler system (like VS 2005) and standalone PC may not have VS 2005 installed (so, there will be no CRT DLLs). It will cause this issue. You need to build the DLL using non-DLL option in Run-Time Library settings.[/color]
  • I don't have the option to rebuild the unmanaged dll (DSVR.dll), it was created an employee who is no longer with the company (C++) (before i was there) , is there any way around it ?

    The unmanaged dll according the dependency walker depends on 15 dll's

    Thanks
    Matt
  • So are all of those 15 DLLs being published along with - also do the DLLs also have all of their dependencies and so on...

    Perhaps there is a spec sheet somewhere that you can just re-write the thing in .net?

    ><//~Psightoplasm`~
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories