简体   繁体   English

如何将FreeImage.dll添加到C#项目

[英]How to add FreeImage.dll to C# project

I have successfully added other .dll files to other C# project this way: 我已经成功地将其他.dll文件添加到其他C#项目中:

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

but Microsoft Visual Studio 2008 issues the following complaint: 但Microsoft Visual Studio 2008发出以下投诉:

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. 我正在使用.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. 我相信这是一个32位的dll(它是用FreeImage3151Win32下载的)所以我把项目的配置更改为x86。

What is the correct method to add FreeImage.dll to a C# project? 将FreeImage.dll添加到C#项目的正确方法是什么?

Use the wrapper provided in the download. 使用下载中提供的wrapper There are C# samples in the \\Wrapper\\FreeImage.NET\\cs\\Samples directory. \\Wrapper\\FreeImage.NET\\cs\\Samples目录中有C# \\Wrapper\\FreeImage.NET\\cs\\Samples

The FreeImage.dll isn't a .Net dll. FreeImage.dll不是.Net dll。 You need to write a wrapper in .Net which call the methods of the unmaged code. 你需要在.Net中编写一个包装器来调用未成像代码的方法。 There is an example here but they also supply a .net wrapper in the binary distribution here 有一个例子在这里 ,但他们在二进制分发版还提供一个.NET包装这里

In the current release (3.15.4), have to build the project in FreeImage\\Wrapper\\FreeImage.NET\\cs to produce the DLL for C#. 在当前版本(3.15.4)中,必须在FreeImage \\ Wrapper \\ FreeImage.NET \\ cs中构建项目以生成C#的DLL。 Then you find it in FreeImage\\Wrapper\\FreeImage.NET\\cs\\Library\\bin\\Release or Debug. 然后在FreeImage \\ Wrapper \\ FreeImage.NET \\ cs \\ Library \\ bin \\ Release或Debug中找到它。

I've seen this before with files downloaded from the Internet that are "blocked" by the file system. 我之前看过这个文件系统“阻止”从Internet下载的文件。 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 将文件保存到Bin文件夹,然后单击项目>添加引用>浏览>双击.dll文件

C# sharp helps link C#sharp有助于链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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