Skip to main content
Kofax

Install a Custom Module to a folder other than the Kofax Capture BIN folder

12343

QAID # 12343 Published

Question / Problem:

Is it possible to create a Managed (VB.NET or C#) Custom Module that does not need to be installed in the Kofax Capture BIN folder?

Answer / Solution:

Normally, a Kofax Capture Custom Module must be installed in the BIN folder, since the Interop Libraries are not in the Global Assembly Cache, and can be changed by upgrades, patches and service packs.

However, it is possible to customize the way the .NET Framework searches for Kofax Capture / Ascent Capture Interop Assemblies by responding to the AppDomain.CurrentDomain's AssemblyResolve event:

Private Shared Function ResolveCaptureAssembly(ByVal sender As Object, _ 
ByVal args As ResolveEventArgs) As System.Reflection.[Assembly]
    Dim CaptureAssemblyLocation As String = args.Name.Split(",")(0) & ".dll" 
    Using KofaxCaptureRegistryKey As Microsoft.Win32.RegistryKey =
Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Kofax Image Products\Ascent Capture\3.0", False)
CaptureAssemblyLocation = IO.Path.Combine(KofaxCaptureRegistryKey.GetValue("ExePath"), CaptureAssemblyLocation)
KofaxCaptureRegistryKey.Close() 
    End Using
    If IO.File.Exists(CaptureAssemblyLocation) Then
        Return System.Reflection.Assembly.LoadFrom(CaptureAssemblyLocation)
    Else
        Return Nothing
    End If
End Function
Shared Sub Main()
    AddHandler AppDomain.CurrentDomain.AssemblyResolve, AddressOf _ ResolveCaptureAssembly
    Application.EnableVisualStyles() 
    Application.DoEvents() 
    Application.Run(New MainForm)
End Sub

 Applies to:

Product Version
CAPTURE 10.0
  10.1
  10.2
  11.0
  • Was this article helpful?