views:

362

answers:

2

Anyone knows any free Visual Studio add-in that would find and/or delete dead (unused) code? I saw such possibility in MZ-Tools, but it's a little expensive as for private use ;)

+1  A: 

Depends... For .NET you can use FxCop for finding usused code and variables.

Simon Linder
Hmm, but FxCop analyzes the managed code. I'm not sure if it would do the thing?
brovar
You get warnings like: CA1804: Remove unused locales; or CA1811: Avoid uncalled private code; So I would say that is something...
Simon Linder
Oh, ok, I'll give it a try.
brovar
+1  A: 

You can also install ReSharper. It generally warns about unused variables and methods in a class file. You can see it as you are coding. It underlines it. It does seem to miss a couple but FxCop did seem to find the rest for me.

UPDATE: Sorry didn't see the FREE part. BUT after using ReSharper for a while it is definitely worth the money.

uriDium
You can at least use it as trial version for some days. I tested it (but didn't buy) and also think that it's really good.
Simon Linder
I've already heard many good things about Resharper, quite expensive unfortunately.
brovar