Note that there are some explanatory texts on larger screens.

plurals
  1. POSystem.DllNotFoundException: Unable to load DLL. No errors in Dev machine but error in target machines
    text
    copied!<p>I built a C# application with WPF on Visual Studio 2012 that uses C++ DLL and targets .NET4.5. I have two projects running, one for the C# project and the other for C++ DLL project. I released both projects into a folder that has a <code>.exe</code> for C# and a <code>.dll</code> for C++ in the same folder.</p> <p>I run them on my machine where they were developed and everything works fine. I run the <code>.exe</code> in other machines and it throws this exception:</p> <blockquote> <p>System.DllNotFoundException: Unable to load DLL</p> </blockquote> <p>It's not recognizing the DLL that is in the same folder. </p> <p>I tried many things and nothing seems to work. I followed the solution in <a href="https://stackoverflow.com/questions/2093485/system-dllnotfoundexception-unable-to-load-dll-on-window-2003">this post</a> but nothing worked.</p> <p>The Dev and Target machine are identical. In Dev, Visual Studio 2012 is installed, but that's the only difference.</p> <h2>Code:</h2> <h3>C#:</h3> <pre><code>[DllImport(@"Wireless.dll", EntryPoint = "?cert_exists@certificate@CertFuncs@@SAHHPBD@Z", CallingConvention = CallingConvention.Cdecl)] static extern int cert_exists(int store, [MarshalAs(UnmanagedType.LPTStr)]string cert_str); </code></pre> <h3>C++:</h3> <pre><code>static int __declspec(dllexport) cert_exists(int type, LPCSTR cert_str); </code></pre> <hr> <h2>Update:</h2> <p>If I install Visual Studio 2012 on the target machine, everything works fine. If I remove it, the application crashes again. Any ideas on what VS is adding that can make the application work?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload