Search code examples
.netclrassembly-resolutionfusionassemblybinding

configure assemblyBinding once for multiple executables


I have a folder that contains multiple executables. Currently the assembly binding redirect is configured in each executable.exe.config file. Is there a way to configure this just once and all executables in that folder pick this up automatically? I'd like to avoid machine.config because this will apply it for the whole computer.

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <publisherPolicy apply="yes" />
  <dependentAssembly>
    <assemblyIdentity name="SomeAssembly" publicKeyToken="10addddbec4aebba" />
    <publisherPolicy apply="yes" />
      <bindingRedirect oldVersion="0.0.0.0-7.9.999.0" newVersion="5.8.11.5" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="SomeOtherAssembly" publicKeyToken="23adeddbac4ae12a" />
    <publisherPolicy apply="yes" />
      <bindingRedirect oldVersion="0.0.0.0-7.9.999.0" newVersion="5.8.11.5" />
  </dependentAssembly>
</assemblyBinding>

Solution

  • It is possible to "split" your configs in different sections and place those sections to external files. You would an almoust empty config for every exe and add there such a section. However the Enterprise Lib offers an application block for this.
    Another solution is to use symbolic file links - aka junction - to redirect every single config to the global one (but I do not recommend doing this).