什么是未使用的程序集引用的成本?成本、程序

2023-09-03 04:52:17 作者:牵猫散步的鱼

我想知道什么引用组件的.NET解决方案的各种费用。我感兴趣的技术和组织成本。

I was wondering what the various costs of referencing assemblies in a .NET solution are. I'm interested in both technical and organizational costs.

一些例子:

在未使用的组件包括额外的字节船(长下载,浪费的空间) 在未使用的大会可能包含可利用的安全漏洞 在未使用的大会可能产生额外的启动成本 在未使用的大会可能产生额外的审查费用(这样的问题) 在未使用的大会可能会混淆一个新的开发

推荐答案

如果您引用的程序集的项目,但实际上并不在该装配使用任何类型的未使用的组件将不会被最终产品的一部分。参考在编译时被删除。

If you reference an assembly in a project but actually don't use any types in that assembly the unused assembly will not be part of your final product. The reference is removed at compile time.

引用未使用的组件的唯一的开销是发展,其中引用许多未使用的组件可能会混淆什么依赖该项目的开发过程中。在你的项目中的每个新的组件也将创造一些开销智能感知和编译器,但在大多数情况下,你不会另行通知。

The only "overhead" of referencing unused assemblies is during development where referencing many unused assemblies may confuse the developer about what dependencies the project has. Each new assembly in your project will also create some overhead for IntelliSense and the compiler but in most cases you wont notice.

ReSharper的具有这样的功能,以分析是否引用程序集未使用。

ReSharper has a function to analyze if a referenced assembly is unused.