I created an C++ MFC Dll project and am trying to call a function in the dll from a C# Class Library project using DllImport.
I seem to remember that when using DllImport you have to also add a reference to the dll in the project you're using it in. When I go to add a refernce to my MFC.dll in the C# Class Library references I get this error:
"A reference to '[path to my dll]mfc.dll' could not be added. This is not a valid assembly or COM component. Only assemblies with extension 'dll' and COM components can be referenced. Please make sure that the file is accessible, and that it is a valid assembly or COM component."
I can clearly see that the dll I'm trying to reference is in fact a .dll so I'm wondering - is the problem that it is *not* a valid assembly or COM component? How would you tell if it is or is not? If anyone has any ideas about what may be causing the error, how to fix it i.e. how to add a reference to that dll, or why what I'm trying to do won't work it would be much appreciated.
*sorry 'bout the double post - wrong language the first time.
I seem to remember that when using DllImport you have to also add a reference to the dll in the project you're using it in. When I go to add a refernce to my MFC.dll in the C# Class Library references I get this error:
"A reference to '[path to my dll]mfc.dll' could not be added. This is not a valid assembly or COM component. Only assemblies with extension 'dll' and COM components can be referenced. Please make sure that the file is accessible, and that it is a valid assembly or COM component."
I can clearly see that the dll I'm trying to reference is in fact a .dll so I'm wondering - is the problem that it is *not* a valid assembly or COM component? How would you tell if it is or is not? If anyone has any ideas about what may be causing the error, how to fix it i.e. how to add a reference to that dll, or why what I'm trying to do won't work it would be much appreciated.
*sorry 'bout the double post - wrong language the first time.