views:

45

answers:

2

We have several library projects which are referenced as using statements like this:

Using XYZ.Controllers;
namespace test
{
   Public partial class testing: System.Web.UI.Page 
   //...
   Private void aTest()
   {
      string Fred=AController.GetAName();
   }
   //...
}

The controller AController would be created in another project (XYZ) which is referenced from this project as above. What I would like to able to do is to identify which routines in the XYZ project are no longer in use. (because code changed, new requirements etc).

Does anyone know of a way of finding out which functions are called and or which are not?

Simon

+3  A: 

ReSharper can do this, if you are willing to pay.

FxCop will do it for compiled code. This is a free utility.

RossFabricant
They've got a free trial as well, so you can check it out before paying.
Brian
I feel Resharper tool is great, except sometimes, it uses so much memory that it slows down your typing.
J.W.
A: 

Ok, the following is not straight-forward, but quite simple and should give good results:

  1. Create a backup of the referenced library (not necessary if you can easily revert your changes using your favorite SCM tool).
  2. Make all members private (search and replace).
  3. Compile and the list of errors will show you all members used.
0xA3