Can't find referenced assembly when compiling for Windows Mobile

孤街浪徒 提交于 2019-12-22 18:49:49

问题


I decided to use tessnet2 library for my Windows Mobile 6 project. Unfortunetly while I am trying to compile it, it throws an error:

  1. The best overloaded method match for 'tessnet2.Tesseract.GetThresholdedImage(System.Drawing.Bitmap, System.Drawing.Rectangle)' has some invalid arguments

  2. 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?


回答1:


Just looking at it, there's no way this is going to work in the Compact Framework. First off the site explicitly says

Tessnet2.dll needs Visual C++ 2008 Runtime

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.

It's a Visual Studio 2008 C++/CLI project

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.




回答2:


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".



来源:https://stackoverflow.com/questions/2162515/cant-find-referenced-assembly-when-compiling-for-windows-mobile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!