为多个可执行文件配置一次 assemblyBinding
我有一个包含多个可执行文件的文件夹。目前,程序集绑定重定向是在每个 executable.exe.config
文件中配置的。有没有一种方法只需配置一次,该文件夹中的所有可执行文件就会自动选择它?我想避免 machine.config 因为这会将其应用于整个计算机。
<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>
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可以将您的配置“拆分”到不同的部分并将这些部分放置到外部文件中。您将为每个 exe 提供一个几乎为空的配置,并在其中添加这样的部分。然而,企业库为此提供了一个应用程序块。
另一种解决方案是使用符号文件链接 - 又名 junction - 将每个配置重定向到全局配置(但我不建议这样做)。
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).
我相信没有办法为多个可执行文件提供一个配置文件。 MSDN 仅提到两个选项 -
executable.exe.config< /code> 和全局
machine.config
。我想到的唯一解决方案是创建一个具有所有当前可执行文件功能(和一种通用配置)的大型可执行文件,然后使当前的可执行文件通过某种开关等运行该大型可执行文件。
I believe there's no way to have one config file for multiple executables. MSDN mentions only two options -
executable.exe.config
and globalmachine.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.