How do I find dead code in a Visual Studio 2008 C# project?
Like unused classes, unused variables or unused resources?
How do I find dead code in a Visual Studio 2008 C# project? Like
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can try FxCop, which is integrated in Visual Studio 2008 by the name of Code Analysis. You just have to right click the project file and ‘Run Code Analysis’.
The active rules can be configured in the Code Analysis section of the project properties. For example some rules relevant to the case in hand are present in Usage Rules and Performance Rules:
And for greater flexibility you also write your own custom rules (Tutorial on writing your own Code Analysis rule).