954,510 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Not able to add dll reference

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,

Mohana88

mohana88
Newbie Poster
16 posts since Mar 2011
Reputation Points: 10
Solved Threads: 1
 

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

abelLazm
Postaholic
2,113 posts since Feb 2011
Reputation Points: 219
Solved Threads: 124
 

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

mohana88
Newbie Poster
16 posts since Mar 2011
Reputation Points: 10
Solved Threads: 1
 

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

Momerath
Nearly a Senior Poster
3,384 posts since Aug 2010
Reputation Points: 1,232
Solved Threads: 558
 

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

mohana88
Newbie Poster
16 posts since Mar 2011
Reputation Points: 10
Solved Threads: 1
 

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

Momerath
Nearly a Senior Poster
3,384 posts since Aug 2010
Reputation Points: 1,232
Solved Threads: 558
 

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

mohana88
Newbie Poster
16 posts since Mar 2011
Reputation Points: 10
Solved Threads: 1
 

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"....

mohana88
Newbie Poster
16 posts since Mar 2011
Reputation Points: 10
Solved Threads: 1
 

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

abelLazm
Postaholic
2,113 posts since Feb 2011
Reputation Points: 219
Solved Threads: 124
 

DLL import statement, like so: [DllImport("User32.dll", SetLastError=true)]
heres a link to help you with the syntax: http://msdn.microsoft.com/en-us/magazine/cc164123.aspx

spdesigns
Newbie Poster
10 posts since Aug 2010
Reputation Points: 10
Solved Threads: 2
 

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

mohana88
Newbie Poster
16 posts since Mar 2011
Reputation Points: 10
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: