Difference between project and dll dependencies in .Net in the final compiled assembly

☆樱花仙子☆ 提交于 2019-12-04 04:19:48
Franci Penov

If the project B sources have not changed in between two builds of project A, there will be no difference in the behavior of the project A output. However, if project B sources have changed, referencing it as a project from project A will cause project B to be rebuilt as well. This difference is what determines your choice of how to reference project B from project A:

  • if you own the source of both project B and project A, and they are tightly coupled, or if they both are under active development and project B undergoes often breaking changes of its public interface, you want to reference project B as project. This would ensure that project A always uses in its build the most up-to-date output of project B.

  • if project B is external dependency you don't develop yourself, or you don't have the sources to, or if it has been shipped already and you can't ship modified version with project A, you want to reference the pre-built project B output, to ensure you are developing and testing with the same version of project B, that is most likely to be on your users' computers.

Adding as project reference just has the advantage that assembly "B" is automatically built if required.

Once assembly "A" is built, there is no difference.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!