嵌入式mono + app.config

时间:2013-04-13 16:39:02

标签: mono

我在c ++程序中嵌入了mono并加载了一个需要app.config的dll。我遇到了这种错误,是否有人知道如何使用嵌入式单声道发送 * .config?

堆栈跟踪:

System.Configuration.ConfigurationErrorsException: Error Initializing the configuration system. ---> System.ArgumentException: The 'ExeConfigFilename' argument cannot be null.
  at System.Configuration.ExeConfigurationHost.CheckFileMap (ConfigurationUserLevel level, System.Configuration.ExeConfigurationFileMap map) [0x00000] in <filename unknown>:0 
  at System.Configuration.ExeConfigurationHost.InitForConfiguration (System.String& locationSubPath, System.String& configPath, System.String& locationConfigPath, IInternalConfigRoot root, System.Object[] hostInitConfigurationParams) [0x00000] in <filename unknown>:0 
  at System.C[] hostInitConfigurationParams) [0x00000] in <filename unknown>:0 
  at System.Configuration.ConfigurationManager.OpenExeConfigurationInternal (ConfigurationUserLevel userLevel, System.Reflection.Assembly calling_assembly, System.String exePath) [0x00000] in <filename unknown>:0 
  at System.Configuration.ClientConfigurationSystem.get_Configuration () [0x00000] in <filename unknown>:0 onfiguration.InternalConfigurationSystem.InitForConfiguration (System.String& locationConfigPath, System.String& parentConfigPath, System.String& parentLocationConfigPath) [0x00000] in <filename unknown>:0 
  at System.Configuration.Configuration..ctor (System.Configuration.InternalConfigurationSystem system, System.String locationSubPath) [0x00000] in <filename unknown>:0 
  at System.Configuration.InternalConfigurationFactory.Create (System.Type typeConfigHost, System.Object

1 个答案:

答案 0 :(得分:1)

自我回答:你不能(截至2013-04-30)。要启用此行为,我必须更改mono的框架源mono / mcs / class / corlib / system / appdomain.cs:

public AppDomainSetup SetupInformation {
    get {
        return SetupInformationNoCopy; // newline
        //  AppDomainSetup setup = getSetup (); //old
        //  return new AppDomainSetup (setup); //old
    }
}