如果我重建项目引用的dll,是否也必须重建项目? [英] If I rebuild a dll that my project references, do I have to rebuild the project also?

查看:60
本文介绍了如果我重建项目引用的dll,是否也必须重建项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在编写此程序( FOO ),其中包含对dll的引用( BAR )。所有 BAR 都包含执行各种不同计算的方法。 FOO 将能够在多台计算机上安装和部署。我的问题是,如果我在其中一种方法中更改了公式(即将 x + y 更改为 x-y ),我是否需要针对新的 BAR 重建 FOO ?更重要的是,仅部署新版本的 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.

总结:


  • 代码更改,没有版本更改且没有强名称-可以

  • 版本更改且没有强名称-可能需要重新编译,建议

  • 代码更改和强大命名-需要重新编译

  • 版本更改和强功能命名-需要重新编译

  • 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

这篇关于如果我重建项目引用的dll,是否也必须重建项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆