公共库和 System.Configuration 命名空间
这是设置:
我们有一个共同的图书馆,我已经 开发出来供所有人使用 任何新应用程序的开发人员或 不仅仅是对旧的微不足道的改变 应用程序。当我们做出改变时, 我们提高了次要版本号(2.0 到 2.1)如果API没有被破坏,但是如果我们破坏了API,那么我们就升级了主要的 版本号(2.1 至 3.0)。有 为每个人构建的安装程序包 新版本并将其部署到 服务器并提供给 开发人员在需要时安装。这 安装程序将程序集放入 服务器上的 GAC,并修改 machine.config 包括一些 配置信息。
最新版本(4.0)大量使用 System.Configuration 命名空间(自定义配置节和配置节组),但是有一个我没有想到的问题,而且我不太确定如何解决:升级版本时,我们与配置部分存在版本冲突。
例如,在 machine.config 文件中,它放入用于指定应用程序名称的配置节信息。它看起来像这样:
<section name="application" type="CommonLibrary.Configuration.ApplicationSection,
CommonLibrary, Version=4.0.0.0, Culture=neutral, PublicKeyToken=sometokenhere" />
现在我们有了 4.1 版本,此部分定义中断,因为应用程序正在使用 4.1 版本 dll,并且机器配置告诉它加载 4.0 版本 dll。
处理这个问题的最佳方法是什么?您必须记住,修复关键问题并使用发布者策略文件将旧版本重定向到较新的次要版本的可能性是存在的,因此解决方案必须考虑到这一点(除非我们决定不允许这样做,并且只允许这样做)对关键问题进行就地修复)有
什么想法?意见?建议?
Here is the setup:
We have a common library that I've
developed that is used by all
developers on any new applications or
more than trivial changes to old
applications. When we make a change,
we up the minor version number (2.0 to
2.1) if the API is not broken, but if we break the API then we up the major
version number (2.1 to 3.0). There is
an installer package built for every
new version and it is deployed to the
servers and made available to
developers to install when needed. The
installer puts the assemblies in the
GAC on the servers, and modifies the
machine.config to include some
configuration information.
The most recent version (4.0) uses the System.Configuration namespace pretty heavily (custom config sections and config section groups), but there's a problem I didn't think of, and I'm not quite sure how to solve: when upgrading versions, we have version clashes with the configuration sections.
For example, in the machine.config file it puts in the config section information for specifying the application name. It looks something like this:
<section name="application" type="CommonLibrary.Configuration.ApplicationSection,
CommonLibrary, Version=4.0.0.0, Culture=neutral, PublicKeyToken=sometokenhere" />
So now that we have version 4.1, this section definition breaks because the application is using the version 4.1 dll and the machine config is telling it to load version 4.0 dll.
What is the best way to deal with this issue? You have to keep in mind that the possibility of fixing a critical issue and using publisher policy files to redirect older versions to newer minor versions is there, so a solution would have to account for that (unless we decided not to allow for that and only do in place fixes for critical issues)
Thoughts? Opinions? Advice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,在与配置相同的领域我能想到的最好的事情就是使用自定义部分。它会稍微改变您的结构,但这样您就可以在混合中拥有自己的属性,例如
LatestVersion=true
,从而消除一些混乱。MSDN - 自定义配置
代码项目 - 自定义配置
Well, best thing I can think of in the same realm with the Configuration is to use Custom Sections. It would change your structure a bit, but that way you could have your own attribute such as
LatestVersion=true
in the mix, taking away some confusion.MSDN - Custom Configurations
Code Project - Custom Configurations