title: Visual Studio System.DllNotFoundException ("Unable to load DLL 'cbw32.dll'" message)
body: <p>Good morning all,</p>
  
  <p>I'm new to C#, and I have to update an already developed application, where I intend to add some new features. I've opened it in Visual Studio 2012 and rebuilt it, apparently with no errors. When I run it, the GUI appears correctly, but when I start the application an error occurs:</p>
  
  <blockquote>
    <p>A first chance exception of type 'System.DllNotFoundException' occurred in MccDaq.dll
    An unhandled exception of type 'System.DllNotFoundException' occurred in MccDaq.dll
    Additional information: Unable to load DLL 'cbw32.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)</p>
  </blockquote>
  
  <p>I've searched the last couple of days for a solution, but I haven't found any. Among many others, I found this thread (<a href="https://stackoverflow.com/questions/9003072/unable-to-load-dll-module-could-not-be-found-hresult-0x8007007e">Unable to load DLL (Module could not be found HRESULT: 0x8007007E)</a>), unfortunately with no luck for me. In fact, searching for the aforementioned DLL ("cbw32.dll"), I wasn't able to find it anywhere in my files. Also, as pointed out in the thread, I've installed Dependency Walker, and analysed "MccDaq.dll" (the file where the System.DllNotFoundException occurred), where errors appear again:</p>
  
  <blockquote>
    <p>Error: Modules with different CPU types were found.
    Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.</p>
  </blockquote>
  
  <p>Googling for this bring little or nothing new, apart from understanding that apparently, I'm having problems with the CPUs architecture in several DLLs, and so here I am. Again I must underline that I'm new to C#, so it wouldn't be surprising that some rookie error is being made here. Nevertheless, here's the code block that triggers the error in Visual Studio:</p>
  
  <pre><code>public ErrorInfo StartBoard(MccDaq.ErrorReporting r, MccDaq.ErrorHandling h) {
  
          //only create another object if the configs are different
          if((daqBoard == null) || (daqBoard.BoardNum != boardNum)) {
  
              daqError = MccDaq.MccService.ErrHandling(r, h);
              daqBoard = new MccDaq.MccBoard(boardNum);
              daqError = daqBoard.DConfigPort(portNum, direction);
          }
  
          return daqError;
      }
  </code></pre>
  
  <p>Another detail that can be important here is that this application was made about 4,5 years ago, so my guess is that it must be programmed using Visual Studio 2008. Regarding this, I've changed, in the project properties, the "Target Framework:" to .NET Framework 3.5, again with no success: the behaviour does not change.</p>
  
  <p>Concluding, I found many different directions where I can go, and that led me to confusion. If someone can enlighten me on this, I'd be totally grateful.</p>