Using different versions of a DLL in a project

Using different versions of a DLL in a project

The Aquaforest OCR SDK makes use of two libraries that can cause problems if referenced individually in a project. The two libraries in question are:

  • iTextSharp
  • Log4Net

If your application makes use of any of these 2 libraries in addition to the Aquaforest SDK, you will need some additional configuration to be able to compile it.

For instance, let’s say your application uses the most recent version of iTextSharp and you are also referencing the Aquaforest SDK, which uses an old version of iTextSharp (4.1.6.0). If you try to compile the application you will end with an error as follows:

Error in OCR Processing: Method not found: 'System.Collections.Hashtable iTextSharp.text.pdf.PdfReader.get_Info()'.

To fix this, you will need to do the following:

  1. Rename the new version of itextsharp. In this example, it’s been renamed to “itextsharp_new.dll”.
  2. Add a reference to “itextsharp_new.dll” to your project.
  3. Modify your app.config file as follows:

2

 

 

 

 

 

 

 

 

If you cannot rename the new itextsharp DLL, you can do the following:

  1. Add a reference to the new version of the itextsharp.dll to your project.
  2. Set “Copy Local” to False.

3

 

 

 

 

 

 

 

 

  1. Create a folder in your bin directory and place the itextsharp.dll in it. In this example, the folder has been renamed to “itextsharp-5.5.8”
  2. Modify your app.config file as follows:

4

 

 

 

 

 

 

 

 

You can get the public token of a DLL by running the following command from the Visual Studio command prompt. Note that the arguments are case sensitive.

sn -T <assemblyname>

1

 

 

 

 

 

 

 

 

The following two tabs change content below.
mm
Neil Pitman founded Aquaforest Limited in 2001 and is the chief architect for the company’s PDF and OCR software products used by thousands of organizations ranging from NASA to the Dutch Ministerie van Justitie. Neil has 30 years’ experience in the software industry in the UK and USA in the areas of database systems, document management and software development tools and has served on the IDT committees of the British Standards Institute (BSI) and was a co-author of the BSI’s 2007 publication on the Long Term Preservation of Digital Documents.