Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

.net

opencv

dll

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

like image 729
Omar Osama Avatar asked Aug 16 '11 15:08

Omar Osama


People also ask

How do I make a DLL file accessible?

To do this open project properties, select the resources tab, select "add existing file" and add the DLL as a resource. Step 2) Add the name of the DLL as a string resource (below as "Resources. DllName").

How do I add a project reference in Visual Studio?

To add a reference, right click on the References or Dependencies node in Solution Explorer and choose Add Reference. You can also right-click on the project node and select Add > Reference.


1 Answers

the file is a native DLL which means you can't add it to a .NET project via Add Reference... you can use it via DllImport (see http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.dllimportattribute.aspx)

like image 154
Yahia Avatar answered Oct 01 '22 01:10

Yahia