简体   繁体   中英

Visual Studio - which references are built?

Is there a means of querying a solution or project to query which dll references are actually used in a build?

I know I can go in and see the references for a project in the "Add Reference" dialogue. I know that I can look in the BIN folder. However, without deleting references and attempting to build, or removing the dlls; is there a means of querying across the solution or project based on Using directives or something similar?

There nothing built in to VS2010 or earlier to perform this cleaning action for C#. You can open your compiled assembly in ILSpy (free tool) or Resharper (don't remember if it's free) and check the references. You can safely remove the references from project if they do not appear in ILSpy.

For each reference, you may find code dependent on this assembly via Resharper. Therefore, if no code is dependent on the reference, you may remove it from project references.

Although there are certain references which you don't use directly in your code (logger library Elmah is a good example) but they still work for you and you need them. Such references must be double-checked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM