为 Windows Mobile 编译时找不到引用的程序集
我决定为我的 Windows Mobile 6 项目使用 tessnet2 库。不幸的是,当我尝试编译它时,它抛出一个错误:
“tessnet2.Tesseract.GetThresholdedImage(System.Drawing.Bitmap, System.Drawing.Rectangle)”的最佳重载方法匹配有一些无效参数
类型“System.Drawing.Rectangle”是在未引用的程序集中定义的。您必须添加对程序集“System.Drawing,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”的引用
好的,我知道。添加对程序集的引用。问题是,我做到了。我通过解决方案资源管理器 (System.Drawing) 中的“添加引用”添加引用,甚至将其声明为“使用 System.Drawing”。
智能感知工作没有任何问题。当我写“矩形”时,它会自动显示顶部带有“矩形”结构的列表。
问题是什么?程序集已添加,即使智能感知看到它,为什么编译器看不到?
I decided to use tessnet2 library for my Windows Mobile 6 project. Unfortunetly while I am trying to compile it, it throws an error:
The best overloaded method match for 'tessnet2.Tesseract.GetThresholdedImage(System.Drawing.Bitmap, System.Drawing.Rectangle)' has some invalid arguments
The type 'System.Drawing.Rectangle' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
OK, I know. Add reference to the assembly. The problem is, that I did it. I add reference by 'Add Reference' in Solution Explorer (System.Drawing), and I even have it declared as 'using System.Drawing'.
Intellisense works without any problem. When i write 'rect' it automaticlly shows me the list with 'Rectangle' structure on top.
What is the problem? The assembly is added, even intellisense sees it, why doesn't the compiler?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看看它,这在 Compact Framework 中是不可能工作的。首先该网站明确表示
那么,这意味着它是为桌面构建的。由于多种原因,它无法在 WinMo 设备上运行,但足以说明您必须为正确的处理器并使用正确的运行时重新编译它。如果它使用诸如内联汇编器之类的东西,这将使移植变得非常非常具有挑战性。
如果您构建了 tessract 库,您仍然无法使用 tessnet2 托管库。
这意味着它是一个托管 C++ 项目。 COCompact Framework 不支持托管 C++。因此,您必须将其移植到 C# 或编写一个单独的 P/Invoke 包装器来调用 tessract 库函数。
Just looking at it, there's no way this is going to work in the Compact Framework. First off the site explicitly says
Well, that means it was built for the desktop. It's not going to work on a WinMo device for many reasons, but suffice it to say that you would have to recompile it for the right processor and using the right runtimes. If it uses anything like inline assembler this is going to make porting it really, really challenging.
If you get the tessract library built, you still can't use the tessnet2 managed library.
This means it's a managed C++ project. Managed C++ is not supported by the COmpact Framework. So you'd have to port that to C# or write a separate P/Invoke wrapper that calls the tessract library functions.
紧凑框架和标准框架是公开相似 API 的 2 个不同的代码库。这就是为什么智能感知“有效”但编译器“抱怨”的原因。
您的第 3 方 OCR 框架需要引用 CompactFramework。下载 Tessnet2 的源代码。将引用的框架程序集替换为紧凑框架程序集。您必须浏览它们并在“C:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE”中找到它们。
The compact framework and standard framework are 2 different code bases that exposes a similar API. That is why intellisense 'worked' but the compiler 'complained'.
Your 3rd party OCR framework needs to reference the CompactFramework. Download the source for Tessnet2. Replace the referenced framework assemblies with compact framework assemblies. You'll have to browse for them and find them in "C:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE".