Every time I do a ConfigurationManager.GetSection("registeredPlugIns")
for this custom section I receive this error:
An error occurred creating the configuration section handler for registeredPlugIns:
Could not load type 'Engine.PlugInArch.PlugInConfigurationSection' from assembly 'System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Why is it trying to load the type from System.Configuration
and not the assembly that I ask it to?
Here is my Section code:
namespace Engine.PlugInArch
{
public class PlugInConfigurationSection : ConfigurationSection
{
[ConfigurationProperty("plugIns", IsDefaultCollection = false),
ConfigurationCollection(typeof(PlugInCollection), AddItemName = "addPlugin")]
public PlugInCollection PlugIns
{
get { return this["plugIns"] as PlugInCollection; }
}
}
}
And here is my app.config
<configuration>
<configSections>
<section name="registeredPlugIns" type="Engine.PlugInArch.PlugInConfigurationSection, Engine"/>
</configSections>
...
<registeredPlugIns>
<plugIns>
<addPlugIn DllName="ProcessorPlugin.dll"/>
</plugIns>
</registeredPlugIns>
</configuration>
Is your dll called Engine.dll? I think not and that is where the problem is.
OK, run procmon from sysinternals. Set the filter to your process name and also filter for result="NAME NOT FOUND". You will see entries where it is looking for Engine.dll or Engine.exe. See where it is looking for it and it is likely the file needs to be copied to the running folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With