Please dont mark -ve it is basic. Hi, In my visual studio2012 I am using tessnet2 library for ocr but unable to compile the code. I have seen
http://www.pixel-technology.com/freeware/tessnet2/
and have made all settings. I placed the tessdata folder in my .exe directory also. I have Microsoft visual c++ 2008 redistributable packages also (both x86 and x64) installed. My system is 64bit. I have also tried only using x64 package by deleting x86. I am using .net4.5 in my setting. I also tried other framework in my project settings. I have also tried x86orx64 or both in my project settings.
I have this code
Bitmap image = new Bitmap("C:\\Users\\Amna\\Documents\\text.tif");
tessnet2.Tesseract ocr = new tessnet2.Tesseract();
ocr.SetVariable("tessedit_char_whitelist", "0123456789"); // If digit only
ocr.Init(#"c:\temp", "fra", false); // To use correct tessdata
List<tessnet2.Word> result = ocr.DoOCR(image, Rectangle.Empty);
foreach (tessnet2.Word word in result)
Console.WriteLine("{0} : {1}", word.Confidence, word.Text);
but I get this error: Could not load file or assembly 'tessnet2_64, Version=2.0.4.0, Culture=neutral, PublicKeyToken=1550524b5ba07e29' or one of its dependencies. The system cannot find the file specified.
I have seen these links as well
Tessnet2 error in C#
IIS 7.5 Fixing An attempt was made to load a program with an incorrect format problem?
and many more.
Do you absolutely have to use the x64 version? I was having a lot of issue until I changed to using x86 version of the Tessnet2 (tessnet2_32.dll). I also changed my .NET framework target to 2.0. and making sure that the target platform is x86 architecture. I also had to make sure that I have the correct language data in tessdata folder where the program executable is. The data must also be a tesseract 2 data and not tesseract 3 data.
Related
i have one safran device and its driver software. but i want to control it using c#. but i am unable to locate the SDK for this morpho biometric scanner. can anyone help me, so that i can make an home application with help of that.
i have tried with following code
using Morpho;
using MorphoAPI_1_0;
using MorphoSdkLiteDotNetWrapper;
Morpho.MorphoSmart.MorphoSmartDevice mSmtDev = new Morpho.MorphoSmart.MorphoSmartDevice();
but this give following error
Could not load file or assembly 'Morpho.MorphoSmart.dll' or one of its dependencies. The specified module could not be found.
You have to copy all of the dll file located in dll folder into the folder where your application will be released, according to your target machine architecture.
Ok, you should have two MorphoSmart libraries. One for x64, one for x86. I was using the x64 one in AnyCpu configuration and I was getting the same error. After switching to the x86 dll it worked fine (with AnyCpu configuration and a x64 operating system).
I am trying to call CPLEX (a mathimatical optimizer) from .NET VS 2013 on win 7.
I have installed optimization.framework.
I have added
using Optimization.Solver.Cplex;
in the code.
I try to run the example at:
http://www-01.ibm.com/support/docview.wss?uid=swg21400073&aid=1
I commented out
//using ILOG.Concert;
//using ILOG.CPLEX;
It can be built. But, I got error:
Unable to load DLL 'cplex100.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
I change the DLL to cplex.dll but the same error.
In
using Optimization.Solver
when I typed ctrl+space , I can see that it includes many solvers, including CPLEX.
Why i got this error.
thanks
If you want to use CPLEX, you need to install it. The DLLs that you need are related to the CPLEX version you install, so cplex100.dll is from CPLEX 10.0, cplex124.dll would be from CPLEX 12.4, and so on. It is a commercial licenced product, but academics can get free/cheap copies.
You need to locate cplex100.dll in your installation and add an appropriate path to your project's linker properties – for your convenience: in detail described here.
I have downloaded tesseract from Here. When i tried to add the dll file to visual studio 2012, its showing error that its not an valid assembly. Can anyone suggest me some other dll file of ocr and sample coding. I've tried many websites but i dint found any good one. Then i found this dll file tessrect and used the following code
string path = #"C:\pic\mytext.jpg";
Bitmap image = new Bitmap(path);
Tesseract ocr = new Tesseract();
ocr.SetVariable("tessedit_char_whitelist", "0123456789"); // If digit only
ocr.Init(#"C:\tessdata\", "eng", false); // To use correct tessdata
List<tessnet2.Word> result = ocr.DoOCR(image, Rectangle.Empty);
foreach (tessnet2.Word word in result)
Console.WriteLine("{0} : {1}", word.Confidence, word.Text);
But visual studio throwing error that its not valid assembly. can anyone help me in this ...
Edit : Error is
Could not load file or assembly 'tessnet2_64, Version=2.0.4.0, Culture=neutral, PublicKeyToken=1550524b5ba07e29' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Thanks n advance
The most common reason I've seen for this error is that the .NET app was built as X86 and you are including an x64 assembly, or vice versa.
Check the configuration manager in visual studio (Build menu) and what the assembly expects.
Update
According to this forum post the DLL you are using is an x86 assembly: https://code.google.com/p/tesseractdotnet/issues/detail?id=16 (unless they've created an x64 version since then)
In that case set your application to x86. If you don't have this available as yet, go into the Configuration Manager (Build menu), and set the Platform to x86. If it's not in the menu you can either edit the existing entries or create a new one by selecting that option in the drop down. If you select new: In the dialog, select the New Platform as x86 and copy the settings from what ever you were using currently.
In my case, this error occurred when I referenced a 32-bit project (DLL) in my 64-bit project.
It was necessary to change in the project configurations the target platform, to use preferably 32 bits:
Image:
When I checked the 32-bit preference, the problem was solved.
how to load a dll in a c# project
error:
Unable to load DLL 'Reader.dll': The specified module could not be
found. (Exception from HRESULT: 0x8007007E)
code sample:
[DllImport("Reader.dll")]
public static extern byte OpenReader(ref IntPtr hCom, byte LinkType, string com_port);
image:
If the problem is really "cannot be found", then using ProcMon from Sysinternals will show you where the system is looking for the DLL.
However, often these sort of exceptions mean 'I found the DLL but I can't load it', and that can be because a dependency of the DLL is missing rather than the DLL itself, or because the DLL is incompatible with the app trying to load it. If your C# app is set for 'Any CPU' and you're on a 64bit machine, you'll get this sort of error loading unmanaged 32-bit DLLs.
One way to isolate the problem would be to create a simple C/C++ project which loads the DLL. (Load it dynamically with LoadLibrary if you don't have access to the import lib.) Then use Dependency Walker to profile the test harness, and it will report the names of missing DLLs.
Although the reader.dll is unable to load GPSVC.dll and IESHIMS.DLL.
i managed to make it work by running the corflags command on application.exe
the application is now marked as 32bit:
corflags application.exe /32bit+
Version : v4.0.30319
CLR Header: 2.5
PE : PE32
CorFlags : 3
ILONLY : 1
32BIT : 1
Signed : 0
I found this in another post. Maybe it will help your situation
NUnit "missing" GPSVC.DLL on Windows 7/64
If it's a simple C DLL it just needs to be in the same folder as the .exe.
For me the solution was to installing the C++ Redistrable X64 on client machine.
(Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019.)
The dll was already on the right place, in the same folder than the .exe file.
Here you found the download link:
https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0
i just wrote a program that uses microsoft encoders and merge videos and audios , its working fine in my PC (Windows7 ) and when i test it on other PCs (Windows7,Windows XP [.net 4.0 installed]] it is giving me following exception
its even giving me exception when i try to run the sample sdk applications to other pcs ..(with no microsoft expression installed)
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass
embly 'Microsoft.Expression.Encoder.Utilities.dll' or one of its dependencies. T
he specified module could not be found.
at Simple.Program.Main(String[] args)
how can i solve this error ,
or what are the ways to deploy standalone application , without pc pre installed microsoft expression studio.
thanks
Microsoft.Expression.Encoder.Utilities.dll is part of Expression Studio. If it isn't installed on the target machine it will not be found.
I don't know if these DLLs can be freely distributed, but you should find out before trying to distribute them with your application.
try to locate this dll-file on your machine, and distribute it with your executable to a pc that hasn't got expression installed.
when a program is about to use a dll, it looks in some predesignated places on the computer. one of the first places is in the folder the executable is executed in. one of the later places is probably c:\windows\system32
you have the filename though, so it shouldn't be that hard. unless microsoft has created some sort of mechanism stopping the distribution of the expression utilities.