When I try to add a dll file into my project the following error occurs :

A reference to dll could not be added. Please make sure that the file is accessible and that is a valid assembly or COM component.

But I have imported the dll file using DLLImport statement. This is urgent. Hence please suggest a solution at the earliest. I tried using regsvr32 also.

Thanks & Regards,


have you checked the location of DLL you want to add is that accessible or not? if not then first place the DLL in you debug folder and then add in your project

It is in the debug folder. Still I am not able to add the reference

You can only add references to managed code DLLs. If you are using DLLImport, it's not a managed DLL.

It is showing an error "Unable to load DLL <name>.dll. The Specific module could not be found" when i try to execute the code with out adding the dll as reference.

Where is the DLL located on your computer? Is it in the same directory as the executable?

yep. Both exe and the dll are in debug folder inside bin

I found the issue.... The DLL is dependent on 2 more DLLs Kernel32.dll and msvcr90.dll. But I am not able to add them into project.... Any ideas??????? Its urgent....... It is saying "DLL loaded.DLLRegistryServer entry point not defined"....

This Link and this link Contains the details of the "DLL loaded.DLLRegistryServer entry point not defined error"

check this link to add Kernel32.dll...and check this link to add msvcr90.dll... You can also take a look at this link

Thanks alot....... I used Dependency walker to find the dependencies of that DLL and solved it