Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Unable to load DLL - Why ??

Unable to load DLL - Why ??

Scheduled Pinned Locked Moved C#
helpcsharpdebuggingquestionannouncement
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    matty2desmara
    wrote on last edited by
    #1

    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

    L J M S 4 Replies Last reply
    0
    • M matty2desmara

      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

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      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


      M 1 Reply Last reply
      0
      • M matty2desmara

        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

        J Offline
        J Offline
        jas0n23
        wrote on last edited by
        #3

        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(); }

        M 1 Reply Last reply
        0
        • L Luc Pattyn

          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


          M Offline
          M Offline
          matty2desmara
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • J jas0n23

            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(); }

            M Offline
            M Offline
            matty2desmara
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • M matty2desmara

              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

              M Offline
              M Offline
              matty2desmara
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              • M matty2desmara

                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

                S Offline
                S Offline
                S Senthil Kumar
                wrote on last edited by
                #7

                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

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups