Delete uncessary references from my csproj, a automatic way?
Existe a possibility to remove or identify all my references in my csproj is not used, if yes its cool for create a most speed and more easy to deploy 开发者_JAVA技巧software? anyone have ideias?
3 ways to solve this:
Easy, but slow and uncool - remove the reference and build, then count the losses (meaning, the error messages);
Little harder, but faster and automatic - write a program which parses your project file and for each reference, removes it and runs MSBuild automatically using Shell and counts the errors;
Hard, but fancy, very fast and automatic - write a program which parses your project file and for each reference:
b) finds the referenced assembly,
c) loads it into memory,
d) lists all of the namespaces and types,
e) does a global search in your project to determine if any type is used in your project.
Your choice. :)
There is a reasonably good Visual Studio extension for this:
- Visual Studio 2010 Reference Assistant
- Visual Studio 2012 Reference Assistant
Right-click on references and 'Remove Unused References'. As the reviews mention, it sometimes seems to remove too much. Maybe they will improve it.
精彩评论