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 (kernel32.dll,...etc) . 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 Files\H&E\DSVR_CSharpExample\Form1.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) ?
Namespace 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);
.
.
.
.Much appreciated, Matt
-
Hi, I created a simple C# program that imports a dll (Unmanaged dll), which a coworker wrote, the dll references other managed dll's (kernel32.dll,...etc) . 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 Files\H&E\DSVR_CSharpExample\Form1.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) ?
Namespace 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);
.
.
.
.Much appreciated, Matt
Hi Matt, the unmanaged DLL might need other unmanaged DLLs and be unable to find them; that would result in the error message you are getting (it is regrettable the message Windows provides isn't more specific). Two likely causes: 1. those DLLs are simply not present (e.g. debug versions of the C run-time library, part of Visual Studio, and not present on other PCs). The easiest solution then is to release-build the native app. 2. those DLLs are present but the folder that contains them is not part of your PATH environment variable. If so, fix the PATH. :)
Luc Pattyn [Forum Guidelines] [My Articles]
Avoiding unwanted divs (as in "articles needing approval") with the help of this FireFox add-in
-
Hi, I created a simple C# program that imports a dll (Unmanaged dll), which a coworker wrote, the dll references other managed dll's (kernel32.dll,...etc) . 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 Files\H&E\DSVR_CSharpExample\Form1.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) ?
Namespace 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);
.
.
.
.Much appreciated, Matt
-
Hi Matt, the unmanaged DLL might need other unmanaged DLLs and be unable to find them; that would result in the error message you are getting (it is regrettable the message Windows provides isn't more specific). Two likely causes: 1. those DLLs are simply not present (e.g. debug versions of the C run-time library, part of Visual Studio, and not present on other PCs). The easiest solution then is to release-build the native app. 2. those DLLs are present but the folder that contains them is not part of your PATH environment variable. If so, fix the PATH. :)
Luc Pattyn [Forum Guidelines] [My Articles]
Avoiding unwanted divs (as in "articles needing approval") with the help of this FireFox add-in
Hi Luc, thanks for the response. All the DLL's are present (according to dependency walker). I've updated the PATh environment variable and the same issue is happening. As a test i installed VS 2008 on the client PC and the app runs (If finds all the dlls), i have a strong feeling it's some sort of pathing issue, does that seem right? (I can't leave VS on the client machine). -md
-
It's possible that those machines do not have the managed DLL's that are being referenced. Are you able to check that those machines have all required DLL's? ...Just a suggestion.. Jay.
foreach( inch on Jason ) { Girlfriend.IsHappier(); }
Hi Jay, The machines have the dlls that's what i don't get (Dependency walker maps out correctly). As a test i installed VS2008 on the machine, and the app ran. What am i missing here ? In my import [DllImport("DSVR.dll", EntryPoint = "DSVR_Open")] is it possible to import from a static location ex. [DllImport("C:\Windows\Systems32\DSVR.dll", EntryPoint = "DSVR_Open")] ?? Thanks -md
-
Hi, I created a simple C# program that imports a dll (Unmanaged dll), which a coworker wrote, the dll references other managed dll's (kernel32.dll,...etc) . 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 Files\H&E\DSVR_CSharpExample\Form1.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) ?
Namespace 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);
.
.
.
.Much appreciated, Matt
I tried setting my DllImport to [DllImport(@"C:\Windows\System32\DSVR.dll", EntryPoint = "DSVR_Open")] , thinking that may work, but on the client end i get : System.DllNotFoundException: Unable to load DLL 'C:\Windows\System32\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 D:\Program Files\Integral\VideoSDK\samples\DSVR Export\Form1.cs:line 127
-
Hi, I created a simple C# program that imports a dll (Unmanaged dll), which a coworker wrote, the dll references other managed dll's (kernel32.dll,...etc) . 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 Files\H&E\DSVR_CSharpExample\Form1.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) ?
Namespace 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);
.
.
.
.Much appreciated, Matt
What version of VS was DSVR built on? You might need to install the appropriate version of the C++ redistributable (VS 2008 C++ redistributable[^]) on a machine without VS. [EDIT : ok, didn't read your question fully.] Can you get an unmanaged app to load the DLL?
Regards Senthil [MVP - Visual C#] _____________________________ My Home Page |My Blog | My Articles | My Flickr | WinMacro