Custom config section: Could not load file or assembly

前端 未结 7 2222
死守一世寂寞
死守一世寂寞 2020-12-15 05:50

I\'m having a very hard time trying to access a custom configuration section in my config file.

The config file is being read from a .dll that is loaded as a plug-in

相关标签:
7条回答
  • 2020-12-15 06:30

    Have you made sure that DLL is loaded first? Perhaps with Assembly.LoadFile("PATH")?

    If you can't get the classes in System.Configuration to work properly, you can always fall back on using XmlDocument to manually parse the configuration file. Use XPaths to make getting the data easier. For example (assuming your path variable above):

    var document = new XmlDocument();
    document.Load(path);
    var node = document.SelectSingleNode("configuration/importWorkflows/add[@name='KEY']");
    // Do whatever with node
    
    0 讨论(0)
提交回复
热议问题