I am writing a DLL which is loaded by a third party application (The FitNesse framework's test runner, the DLL is a test fixture).
The DLL has its own App.config file (say MyDll.dll.config), and I can tell FitNesse to load that App.config file.
But here's the problem: The App.config file contains custom config section handler, like this:
<configuration>
<configSections>
<sectionGroup name="myGroup">
<section name="MySection" type="MyNamespace.MyHandler.MySection, MyNamespace.MyHandler"/>
...
</sectionGroup>
</configSections>
...
</configuration>
Whenever the App.config file is read, the I get an exception saying that the MyNamespace.MyHandler assembly cannot be found, although it sits in the same folder as the MyDll.dll.config file being read:
System.TypeInitializationException: The type initializer for 'MyNamespace.MyHandler.MySection' threw an exception. ---> System.Configuration.ConfigurationErrorsException: An error occurred creating the configuration section handler for myGroup/MySection: Could not load file or assembly 'MyNamespace.MyHandler' or one of its dependencies. The system cannot find the file specified
I can see that the system looks for this file in the same folder where the executable that is loading my DLL is located. However, I do not want to copy my files into this third party directory or vice versa.
Is there a way to specify where the system should look for the DLLs to interpret the App.config file? A general solution or a FitNesse-specific solution would both work for me.
Thanks a lot in advance for any help!
You could try using the runtime section as explained here: