Last Reviewed: August 5, 2013
Applies to: dtSearch Engine 6.40 and later
One of these errors occurs running an application that uses the dtSearch Engine's .NET API:
This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.
Activation context generation failed for [application component]
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in [program name]
Additional information: File or assembly name dtSearchNetApi, or one of its dependencies, was not found
Unhandled Exception: 'System.TypeInitializationException': The type initializer for 'ApiInitializer' throw an exception. ---> System.IO.FileNotFoundException: dten600.dll.
You may also be missing one or more of the Microsoft runtime library DLLs. Please see this article for information on the components required for each version of dtSearchNetApi*.dll:
The dtSearch .NET API wrapper (dtSearchNetApi2.dll, dtSearchNetApi3.dll, or dtSearchNetApi4.dll) depends on the dtSearch Engine DLL, which is dten600.dll (32-bit) or dtengine64.dll (64-bit). In .NET applications, an unmanaged DLL dependency can be separated from the managed assembly when it executes. This occurs in ASP.NET applications when the application is copied to a temporary folder for execution. A DLL dependency of an assembly is not copied in this process.
If the dtSearch Engine DLL is not on the system PATH, and if its type library is not registered, then it will not be found when the .NET application executes, and the application will fail with an ApiInitializer exception or a FileNotFound exception.
To resolve the issue, there are several possible ways to tell the .NET API wrapper where to find the dtSearch Engine DLL.
The Server.SetEnginePath method provides a direct way for your application to tell the dtSearch Engine's .NET API where to find the dtSearch Engine DLL.
For applications other than ASP.NET applications, this is the recommended solution because it ensures that your application will run with the exact dtSearch Engine version that you include with the application. In ASP.NET applications, this will not work because ASP.NET copies the application to a temporary folder to execute, and the dtSearch Engine DLL file gets left behind in this process, so copying the DLL into the BIN folder for your application does not resolve the missing dependency at runtime.
To register the 32-bit dtSearch Engine DLL, execute this command from the command prompt:
To register the 64-bit dtSearch Engine DLL, execute this command from the command prompt:
dtSearchNetApi*.dll does not use the COM type library that regsvr32 registers, but it uses the registry entry created by regsvr32 to determine where the DLL is located, which provides a simple way to ensure that it can always be located.
Windows can automatically find a DLL that is on the system PATH, so this will reliably fix missing DLL problems. To do this, either copy dten600.dll to a folder that is listed on the system PATH, such as the c:\windows folder, or add the folder where dten600.dll is located to the system PATH (see "How to change the system PATH" below for instructions).
This will work but has a significant disadvantage: Once the dtSearch Engine DLL is separated from the rest of the deployed files in your application, it may not be updated when you update your application, resulting in application problems.
The PATH is a list of folder names that Windows uses to locate executables. The following steps will add the dtSearch program folder to the system PATH.
(1) Click Start > Settings > Control Panel
(2) Click System
(3) Click the Advanced tab.
(4) Click the Environment Variables button
(5) Under System variables, locate the "Path" variable and click on it
(6) Click the Edit button
(7) Add this to the end of the current value (assuming you installed dtSearch to the default location):
;c:\Program Files\dtSearch Developer\bin
The semicolon is needed to separate the dtSearch directory name from the last item listed in the existing PATH.
A reboot may be necessary for some programs to recognize the change to the PATH.