David Schmitt
David Schmitt

Reputation: 59346

What's the costs of unused assembly references?

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

Some examples:

Upvotes: 8

Views: 1030

Answers (3)

Marijn
Marijn

Reputation: 10557

In my opinion the organizational overhead for me (and my co-workers) to even think about unused references (why do we need XML here?) is enough motivation to remove them. Consequently, I have never considered the impact on deployment or performance.

Upvotes: 1

Robert MacLean
Robert MacLean

Reputation: 39261

If you use nothing from the assembly then they are stripped out when compiled so the cost is nothing.

Upvotes: 0

Martin Liversage
Martin Liversage

Reputation: 106826

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 has a function to analyze if a referenced assembly is unused.

Upvotes: 11

Related Questions