A task is failing at run time with the following error: “Could not load file or assembly”

Symptom

A task is failing at runtime and errors similar to the following are being produced:

TIAPI: Type Information Error while loading tool assembly for step SAP Business One Connector. See Windows Event Viewer for more details.

The Windows application log will display something similar to the following:

Could not load file or assembly 'file:///C:\Program Files (x86)\Orbis Software\TaskCentre for SAP Business One\TaskCentre Tools for SAP Business One\SBOConnectorTool.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

Cause

The application configuration file responsible for supplying the correct assembly version is not being detected.

OR

There is a missing “startup” section in the configuration files for the Task runner and licensing component.

Solution 1

Within the TaskCentre installation directory, ensure the name of the configuration file iwtskrun.exe.config is correct. It should not display as anything else,for example: iwtskrun.exe.config.config

If this file has an incorrect name then the correct assembly version will not be detected.

Solution 2

If the filename is correct then add the following “startup” section to the iwtskrun.exe.config and iwaplicr.exe.config files located within the TaskCentre installation directory:

<startup useLegacyV2RuntimeActivationPolicy="true">
   <supportedRuntime version="v4.0.30319"/>
   <supportedRuntime version="v2.0.50727"/>
</startup>

Example:
Capture

Figure 1. Example showing where the “startup” section should be placed.

Important

The naming of these configuration files are dependent on the underlying version of Windows OS. Versions up to and including 2003 required the files to be named *.config, whereas 2008 onwards have required *.exe.config.

1

Figure 2. Naming of the CONFIG files for 2008 onwards.