How to programmatically modify assemblyBinding in app.config?

后端 未结 3 895
广开言路
广开言路 2020-12-19 01:33

I am trying to change the bindingRedirect element at install time by using the XmlDocument class and modifying the value directly. Here is what my app.config looks like:

3条回答
  •  抹茶落季
    2020-12-19 02:05

    Sounds like you've got your configuration file tweak working now, but I thought you might still be interested in how to adjust binding redirects at run time. The key is to use the AppDomain.AssemblyResolve event, and the details are in this answer. I prefer it over using the configuration file, because my version number comparison can be a bit more sophisticated and I don't have to tweak the configuration file during every build.

提交回复
热议问题