如果我重建我的项目引用,我已经重建项目的一个dll?

问题描述:

我一直在写这个程序( FOO ),它包括一个DLL的引用( BAR )。所有 BAR 包含是执行各种不同的计算方法。 FOO 将能够安装并部署到多台计算机。我的问题是,如果我的方法之一(改变一个公式,即改变 X + Y 说明X - Y ),我需要重建 FOO 对新的 BAR ?更重要的是,它是安全的,只是部署 BAR

I've been writing this program(FOO), and it includes a reference to a dll(BAR). All BAR contains is methods which perform various different calculations. FOO will be able to be installed and deployed on multiple computers. My question is, if I change a formula in one of the methods(i.e. change x + y to x - y), will I need to rebuild FOO against the new BAR? More importantly, is it safe to just deploy the new version of BAR?

@ vcsjones的评论在这里提出了一个很重要的一点。

@vcsjones's comment raises an important point here.

您可以在一个新的DLL下降作为替代当且仅当组装版本没有发生变化,没有使用强名称的程序集。

You can drop in a new DLL as a replacement if and only if the assembly version does not change and you are not using strong named assemblies.

如果版本不改变,那么你的可能的接收运行时错误,因为你的程序尝试装载特定的版本,并得到比预计的不同版本。这可能不过正常工作,如果没有一种方法签名已更改,但我也不能保证它,总是建议重新编译。

If the version does change then you may receive runtime errors because your program tries to load a specific version and gets a different version than it expects. This may however work fine if no method signatures have changed but I wouldn't guarantee it and would always recommend a recompile.

这是即使在使用时强烈的问题更多因为强名称同时编码版本和组件的数字签名命名程序集。因此,如果任何代码在装配时已改变,那么该数字签名会,即使版本还没有,因此强名称的改变而改变。

This is even more of a problem when using strong named assemblies since the strong name encodes both the version and a digital signature of the assembly. So if any code has changed in the assembly then the digital signature will change even if the version has not, hence the strong name changes.

同样,这将导致运行时错误,因为强名称程序预计将不匹配的程序集强名称。所以,在这种情况下,重新编译总是需要

Again this will cause runtime errors because the strong name your program expects will not match the assembly strong name. So in this case a recompile is always required.

要总结:


  • 代码更改,没有版本更改和无强名称 - OKS

  • 版本变化而无强名称 - 可能需要重新编译,建议

  • 代码变化与强命名 - 需要重新编译

  • 版本变化与强命名 - 需要重新编译

  • Code Change, No Version Change and No Strong Names - OKs
  • Version Change and No Strong Names - May require recompile, recommended
  • Code Change and Strong Named - Requires recompile
  • Version Change and Strong Named - Requires recompile