How do I resolve "Please make sure that the file is accessible and that it is a valid assembly or COM component"?

Omar Osama picture Omar Osama · Aug 16, 2011 · Viewed 125.8k times · Source

I am building a project with OpenCV in C#. It requires a dll file called cvextern.dll. but, when adding this file as a reference, this message appears :-

a reference "cvextern.dll" can't be added, Please make sure that the file is accessible and that it is a valid assembly or COM component.

I get tired from searching, I spent the past 2 days in searching for a solution for that problem

Answer

user2248818 picture user2248818 · Apr 5, 2013

In my case I had to register the .dll.

To do so, open cmd.exe (the console) with admin rights and type:

regsvr32 "foo.dll"