Skip to content

About

This is .Net Repo to remove all unused variables, classes and functions

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

Roslyn Analyzer Tool

This project uses the Roslyn compiler platform to analyze C# code and extract all ununsed variables, classes and functions and also you can comment it out. The analysis results are also exported to Excel using EPPlus there is one sample code added for saving it in excel for unused classes.

🚀 Features

  • Load and analyze a C# Solution or Project using MSBuildWorkspace
  • find all unused variables, functions and classes.
  • comment out all unused code.
  • Export analyzed data to Excel (.xlsx) using EPPlus
  • Supports both CLI-based and extensible Roslyn workflows

🛠️ Technologies Used

  • .NET SDK (6/7/8)
  • Roslyn (Microsoft.CodeAnalysis)
  • EPPlus (Excel file generation)
  • MSBuild Workspace support (Microsoft.Build.Locator)

📦 Dependencies

Make sure the following NuGet packages are installed:

dotnet add package Microsoft.Build.Locator
dotnet add package Microsoft.CodeAnalysis.Workspaces.MSBuild
dotnet add package Microsoft.CodeAnalysis.CSharp.Workspaces
dotnet add package Microsoft.CodeAnalysis.FindSymbols
dotnet add package EPPlus

🧑‍💻 Getting Started

1. Clone the Repo

git clone https://github.com/your-username/roslyn-analyzer.git
cd roslyn-analyzer

2. Build the Project

dotnet build

3. Run the Analyzer

Update the path to your .sln or .csproj in Program.cs and excel file path, then:

dotnet run

The output Excel file will be saved to the project directory.

📝 License

This project uses EPPlus under its Polyform Noncommercial License. You must set the license context:

ExcelPackage.LicenseContext = LicenseContext.NonCommercial;

🙋‍♀️ Contributions

Feel free to fork, improve, and submit PRs. Open issues for bugs or feature requests!


Made with ❤️ using .NET and Roslyn

About

This is .Net Repo to remove all unused variables, classes and functions

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages