2010-12-08 29 views
0

我有一个包含多个可执行文件的文件夹。目前,每个executable.exe.config文件都配置了程序集绑定重定向。有没有一种方法可以只配置一次,并且该文件夹中的所有可执行文件都会自动将其选中?我想避免machine.config,因为这将适用于整个计算机。为多个可执行文件配置assemblyBinding一次

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

回答

1

可以在不同部分“分割”你的配置并将这些部分放到外部文件中。你会为每个exe文件清空配置文件,并在其中添加这样一个部分。但Enterprise Lib为此提供了一个应用程序块。
另一种解决方案是使用符号文件链接 - 又名junction - 将每个配置重定向到全局配置(但我不建议这样做)。

0

我相信没有办法为多个可执行文件创建一个配置文件。 MSDN只提及两个选项 - executable.exe.config和全球machine.config

是来到我心中唯一的解决方案是创建一个大的可执行文件,具有目前所有的可执行文件的功能(和一个常用的配置),然后让你的当前可执行文件运行大单以某种开关等

相关问题