C DLL doesn't load in C#
I have a simple C DLL (not COM). I have also a C# 2.0 application that runs it (dllimport). The dll is placed in the exe of the application. I know that the dll is ok and also that my application that calls it success reading it, but when I move them to another compute开发者_StackOverflowr it says that it can load the dll.
The error : "Unable to load the dll name.dll . This application has failed to start because the application configuration is incorrect."
I used visual studio 2005 to create the dll. The targer computer is a side by side one. When I took the folder of the side by side contains the CRT it didn't run. Thanks
The C Dll can have various dependencies. Try using Dependency Walker tool to determine if there are any of them.
Windows may have detected a side-by-side version configuration issue with your application.
For example, the C dll will usually be compiled against a particular version of the Microsoft C runtime library , which might not be installed on your second computer. It also doesn't have to be the C runtime library, it may be some other library.
How to diagnose it?
Check out this article, http://blogs.msdn.com/junfeng/archive/2006/04/14/576314.aspx for a starting point, although no guarantees.
I used a lot from the comments people wrote and they are right. I used : Dependency Walker tool and process moniter and process explorer. I had a prblem of not detecting the right msvr80 at runtime by my application. I instaalled destributable package af VC++ amd didn't help. The answear was in another discussion here and it Side-by-side configuration error (Microsoft.VC80.CRT v8.0.50608.0) It was a problem of security update : Microsoft.VC80.CRT v8.0.50727.4053 (Installed via a security update).
精彩评论