Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Visual Studio optimizing transitive references?

I'm sorry in advance for the, not so clear, title.

I've encountered a strange behavior in Visual Studio (2010).

Lets say that I have three projects in my solution: A, B and C.

A has a reference on B

B has a reference on C

C has a reference on an assembly (log4net.dll)

All of which are configured to Copy Local True.

I'm responsible for project A and two other developers are responsible for project B and C.

Project B is using several (static) methods that reside in project C in one of its classes. I'm using other classes from B that are not using anything from C.

When I built the solution (project A is configured as the main project), I expected to see the results of C and its referenced assemblies in the output folder of project A. What actually happened was that the results of C were copied to the output folder of B but were absent in the output folder of A.

It took me some time to figure out that the reason for this was that A is not using anything from C (directly or indirectly).

So the question is: is it a built in optimization feature of Visual Studio or am I doing something wrong?

like image 876
Michael Avatar asked Jan 08 '14 13:01

Michael


1 Answers

Yes, it's a feature. If you don't use any of the types from the referenced assembly, it doesn't get copied.

like image 146
Ufuk Hacıoğulları Avatar answered Sep 22 '22 21:09

Ufuk Hacıoğulları