Deploying .NET satellite assemblies in specific folder

I'm working on a C# .NET application and I'm performing localization with resource files. I have culture specific resource files like:

  • MyResource.resx;
  • MyResource.fr-FR.resx;
  • MyResource.ja-JP.resx;

After building, in the application root folder there are folders like fr-FR, ja-JP and so on.

Is it possible to move all localization resource files and folders into the same folder, for example Languages?

Update 1:

I solved this with the code below. it seems that when i copy the application to another place, it can't load resources. As i can see, application.config file need to be there also. And if i make app.config as embeded resource, it doesnt working.

Is there a way, how to make this without the .config file needed in same directory?

Thanks


By default the satellite assemblies are placed in the sub-directories directly below the executable file. If you want to move all the fr-FR, ja-JP and remaining folders for other cultures into the same folder Languages you can do it by adding the following entry into the application configuration file:

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="Languages"/>
    </assemblyBinding>
  </runtime>
</configuration>

This will indicate that when searching for assemblies the CLR should search in the default locations and also in the directory or directories specified by the privatePath attribute of the probing element. You can specify any directories that exists below the application executable file. When specifying more than one sub-directory you need to delimit each one with a semicolon.


My ResX files under Properties are below:

  • Resources.resx
  • Resources.tr-TR.resx

I put the runtime information into application configuration file as described above but no change. still creating a tr-TR folder under the executable path, not under Languages folder. What possibly I'm doing wrong here? Thanks

<configuration>
...
<runtime>
...
</runtime>
</configuration>