简体   繁体   中英

How to add FreeImage.dll to C# project

I have successfully added other .dll files to other C# project this way:

Right click Reference > Add Reference > Browse > Double click the .dll file

but Microsoft Visual Studio 2008 issues the following complaint:

A reference to ...\\dll\\FreeImage.dll could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component.

I am using .NET Framework 3.5. I believe this is a 32bit dll (it downloaded with FreeImage3151Win32) so I changed the configuration of the project to x86.

What is the correct method to add FreeImage.dll to a C# project?

Use the wrapper provided in the download. There are C# samples in the \\Wrapper\\FreeImage.NET\\cs\\Samples directory.

The FreeImage.dll isn't a .Net dll. You need to write a wrapper in .Net which call the methods of the unmaged code. There is an example here but they also supply a .net wrapper in the binary distribution here

In the current release (3.15.4), have to build the project in FreeImage\\Wrapper\\FreeImage.NET\\cs to produce the DLL for C#. Then you find it in FreeImage\\Wrapper\\FreeImage.NET\\cs\\Library\\bin\\Release or Debug.

I've seen this before with files downloaded from the Internet that are "blocked" by the file system. Try going into the file's properties and clicking the "Unblock" button.

Save the file into the Bin folder and click Project > Add Reference > Browse > Double click the .dll file

C# sharp helps link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM