开发者

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:

  1. Easy, but slow and uncool - remove the reference and build, then count the losses (meaning, the error messages);

  2. 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;

  3. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜