Simon Norburn
Simon Norburn

Reputation:

Finding used functions in a library project

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

Upvotes: 1

Views: 162

Answers (2)

Dirk Vollmar
Dirk Vollmar

Reputation: 176259

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.

Upvotes: 0

RossFabricant
RossFabricant

Reputation: 12492

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

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

Upvotes: 3

Related Questions