【发布时间】:2021-01-27 12:07:32
【问题描述】:
我一直在阅读和搜索如何使这项工作发挥作用,但我无法让我的应用重新加载或刷新它的加载设置。这是我的 exe.config 中的一个部分:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Tekla.Structures.Model" publicKeyToken="2f04dbe497b71114" culture="neutral" />
<bindingRedirect oldVersion="17.0.0.0-99.1.0.0" newVersion="18.1.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
我需要将 newVersion 更改为 18.0.0.0,这很容易做到。问题是一旦我这样做了,如果不从头开始手动启动应用程序,我就无法让应用程序加载该信息。
我已经根据我的搜索尝试了所有这些组合,但似乎都不起作用:
System.Configuration.ConfigurationManager.RefreshSection("runtime");
System.Configuration.ConfigurationManager.RefreshSection("assemblyBinding");
System.Configuration.ConfigurationManager.RefreshSection("runtime/assemblyBinding");
System.Configuration.ConfigurationManager.RefreshSection("runtime/assemblyBinding/dependentAssembly");
System.Configuration.ConfigurationManager.RefreshSection("runtime/assemblyBinding/dependentAssembly/bindingRedirect");
我需要做什么才能重新加载?
【问题讨论】:
-
看看这个 SO 帖子stackoverflow.com/questions/325788/…
-
谢谢,看来这是不可能的,所以我找到了另一个解决方案来解决我真正想做的事情。
标签: c# app-config