title: How to get location of current culture's satellite assembly?
body: <p>My C#/WF application uses some files, which are different for different languages. These file <strong>can not</strong> be placed as resources in satellite assemblies. I wish however to put them in the same directories as the satellite assemblies reside, but I need to know actually where the assembly resides (including the situation, when default language embedded in the binary file is used).</p>
  
  <p>For example, when application switches automatically to polish language, I wish to retreive location:</p>
  
  <p>D:\&lt;app folder&gt;\pl-PL\</p>
  
  <p>Is there a way to do so? Please note, that I wish to retreive this information from the assembly and not by guessing the folder location.</p>
  
  <hr />
  
  <p>With help of Steve B, here's a solution:</p>
  
  <pre><code>string FindSatelliteAssemblyLocation(CultureInfo culture)
  {
      if (culture == CultureInfo.InvariantCulture)
          return Path.GetDirectoryName(Application.ExecutablePath);
  
      try
      {
          Uri location = new Uri(Assembly.GetExecutingAssembly().GetSatelliteAssembly(culture).CodeBase);
          return Path.GetDirectoryName(location.LocalPath);
      }
      catch
      {
          return FindSatelliteAssemblyLocation(culture.Parent);
      }
  }
  </code></pre>