2012-04-12 20 views
1

私は(ウェブサイト|ウィンドウズ)アプリケーションとdll(クラスライブラリ)を持っています。私は、dllのルート(ウェブサイト|ウィンドウ)の設定ファイルのパスを取得したいです。dll内のルート設定ファイルのパスを取得する

私はAssemblyManager.OpenExeConfigurationを別のassembly.getで試しましたが、それらは常にdll設定パスを与えていました。

おかげ

答えて

0

こんにちははこれを発見し、それは、その場合は、ウェブサイトのweb.configファイルを取得し、それがその場合は、Windowsアプリ

をapp.exe.config取得するだけでなく

Configuration config; 

     if (System.Web.HttpContext.Current != null && 
      System.Web.HttpContext.Current.Request.PhysicalPath.Equals(String.Empty) == false) 
     { 
      config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(HttpRuntime.AppDomainAppVirtualPath); 
     } 
     else 
     { 
      config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); 
     } 

Basiclyの作品

関連する問題