read probing path from dll.config file

how can force application to read probing path from abc.dll.config file instead of application config file. Because I have created addin for which application is Excel.exe and I wants to read probing path value from dll.config file

Thanks in advance



Answer this question

read probing path from dll.config file

  • Charley Lou

    this gives correct value for configuration , but how it will change current domain set up values. here is alternate code I am using.

    But it seems like that excel is still searching for assemblies in Excel.exe folder instead of "dll folder\assemblies\".

    private void setAppDomain() {

    string dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

    AppDomain.CurrentDomain.SetData("APP_NAME", "MyCOMAddin.dll");

    AppDomain.CurrentDomain.SetData("APPBASE",dir);

    AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", dir + "\\" + "MyComaddin.dll.config");

    AppDomain.CurrentDomain.SetData("PRIVATE_BINPATH", "assemblies");

    }


  • hcaihao

    Try using that inside of your DLL (not your actual application but inside the DLL) .

    Configuration Tmp = ConfigurationManager.OpenExeConfiguration(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "myconfig.config"));


  • read probing path from dll.config file