# ILSpy — Open-Source .NET Decompiler > A cross-platform .NET assembly browser and decompiler that supports PDB generation and multiple output formats. ## Install Save as a script file and run: # ILSpy — Open-Source .NET Decompiler ## Quick Use ```bash # Install via .NET tool (requires .NET SDK) dotnet tool install ilspycmd -g # Decompile an assembly to a project directory ilspycmd -p -o ./output MyAssembly.dll # Decompile a single type ilspycmd -t MyNamespace.MyClass MyAssembly.dll ``` ## Introduction ILSpy is an open-source .NET assembly browser and decompiler maintained by the icsharpcode team. It provides both a GUI application for Windows and a cross-platform command-line tool for decompiling .NET assemblies into readable C#, VB.NET, or IL code. The project serves as a widely used alternative to commercial .NET decompilers. ## What ILSpy Does - Decompiles .NET assemblies (DLLs and EXEs) into C#, VB.NET, or IL code - Browses assembly metadata, types, members, and resources in a tree view - Generates PDB debug symbol files for decompiled assemblies - Exports decompiled code as complete Visual Studio project files - Supports .NET Framework, .NET Core, and .NET 5+ assemblies ## Architecture Overview ILSpy is built on top of the ICSharpCode.Decompiler library, which handles the core IL-to-C# translation pipeline. The decompiler processes CIL bytecode through multiple transformation stages including control flow analysis, type inference, pattern matching for high-level constructs, and finally C# AST generation. The GUI frontend uses Avalonia for cross-platform support while the command-line tool (ilspycmd) provides the same decompilation engine for CI/CD and scripting workflows. ## Self-Hosting & Configuration - Download pre-built binaries from the GitHub releases page or install via winget/dotnet tool - The GUI version runs standalone on Windows with no installation required - Configure decompiler settings such as target language version and output formatting through the options dialog - Plugin support allows extending ILSpy with custom language backends or analysis tools - The command-line tool integrates into build pipelines for automated decompilation tasks ## Key Features - Cross-platform support via Avalonia UI and the ilspycmd .NET global tool - Search functionality across loaded assemblies for types, members, and string literals - Assembly diffing to compare two versions of a .NET assembly - NuGet package loading to decompile packages directly from feeds - ReadyToRun (R2R) and Native AOT assembly support for modern .NET workloads ## Comparison with Similar Tools - **dnSpy**: Offers integrated debugging and editing of assemblies but is no longer actively maintained; ILSpy focuses on decompilation and browsing - **dotPeek (JetBrains)**: Free but closed-source with JetBrains ecosystem integration; ILSpy is fully open-source and extensible - **JustDecompile (Telerik)**: Another free closed-source option with plugin support; ILSpy provides source access and community-driven development - **Reflector (.NET)**: One of the earliest .NET decompilers, now commercial; ILSpy was originally created as its free replacement ## FAQ **Q: Can ILSpy decompile .NET Core and .NET 5+ assemblies?** A: Yes. ILSpy supports .NET Framework, .NET Core, .NET 5, 6, 7, 8, and newer runtimes through the ICSharpCode.Decompiler library. **Q: Does ILSpy run on Linux and macOS?** A: The GUI version is available cross-platform via Avalonia, and the ilspycmd command-line tool runs on any platform with the .NET SDK installed. **Q: Can I generate PDB files for debugging decompiled code?** A: Yes. ILSpy can generate portable PDB files that allow you to step through decompiled source in a debugger like Visual Studio. **Q: Is ILSpy suitable for recovering lost source code?** A: ILSpy produces readable C# or VB.NET code from compiled assemblies, though the output may differ from the original source in variable naming and some high-level constructs. ## Sources - Repository: https://github.com/icsharpcode/ILSpy - Documentation: https://github.com/icsharpcode/ILSpy/wiki --- Source: https://tokrepo.com/en/workflows/asset-68b61a2f Author: Script Depot