Find out why Visual Studio decides to copy DLLs in

2019-08-18 19:15发布

问题:

I have a web application project. I am trying to find out why certain DLLs are being copied into the bin directory of the web application. As far as I can see there are no references to the DLLs under the list of references.

Whilst I don't think it should make a difference, I have been through all the DLLS of the projects that the web application depends upon and selected Copy Local=False.

But still when I build the solution, the DLLs turn up in the bin directory. I don't want them there. How can I find out what is putting the DLLs there?

回答1:

An indirect reference perhaps?

That is, you reference assembly A and it references assembly B and C. Presto! B.dll and C.dll are in your bin folder. Use reflector or ildasm to check the references of the assemblies you have referenced in you project.



回答2:

Check out your Post-build events which you can find in Project Properties->Build Events->Post-build event. There might a command-line instruction to copy a DLL into your bin directory.