문제

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>
도움이 되었습니까?

해결책

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).

다른 팁

I believe there's no way to have one config file for multiple executables. MSDN mentions only two options - executable.exe.config and global machine.config.

The only solution that came to my mind is to create one big executable that has all current executables functionality (and one common configuration) and then make your current executables run the big one with some kind of switch etc.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top