When trying to add a reference to a DLL file (made with ANSI C++) to a VS2005 C# project, by right click on references, add reference, I receive the following error in both of them:
"A reference to 'dllFileName.dll' could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component."
Now When I try to use the TlbImp on a .dll file the following error appears:
"The input file 'dllFileName.dll' is not a valid type library".
How can I resolve this problem.

problem in adding reference to a DLL file
mostaf
Using Platform invoke to call any function, e.g.,'DeInitializeSearch', within the .dll file produces the following error message:
"Unable to find an entry point named 'DeInitializeSearch' in DLL 'SearchAuto1.dll'.".< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
malangpc
RuiDC
Digital-Pioneer
Thank you too much for your reply.
When I use the OleView tool on the dll file I get the following message:
"LoadTypeLib(myDllFile.dll ) failed. Error loading type library/DLL.
TYPE_E_CANTLOADLIBRARY($80029C4A)".
So, what can I do
Thanks.
Ayooya.
naryn
It is likely that you have not created a COM component, so you will not be able to add a reference to it.
If you have a DLL that exports some functions, then you can use platform invoke to call it - look it up in MSDN.