### Install WiX Toolset Global Tool Source: https://github.com/icsharpcode/ilspy/blob/master/ILSpy.Installer/README.md Installs the WiX toolset as a global .NET tool. This is a prerequisite for building the installer. ```bash dotnet tool install --global wix ``` -------------------------------- ### Install ILSPYCMD .NET Tool Source: https://github.com/icsharpcode/ilspy/blob/master/ICSharpCode.ILSpyCmd/README.md Installs the ILSPYCMD .NET tool globally. This command should be run once to make the tool available on your system. ```bash dotnet tool install --global ilspycmd ``` -------------------------------- ### Specify Configuration File Example Source: https://github.com/icsharpcode/ilspy/blob/master/doc/Command Line.txt Provides a specific configuration file to be used by ILSpy. This allows for custom settings and behaviors. ```bash ILSpy --config:myconfig.xml ``` -------------------------------- ### Build ILSpy Binaries for Any CPU Source: https://github.com/icsharpcode/ilspy/blob/master/ILSpy.Installer/README.md Builds the ILSpy installer solution for the 'Release' configuration targeting 'Any CPU' platform. This command is used to prepare the necessary binaries. ```bash msbuild ILSpy.Installer.sln /p:Configuration="Release" /p:Platform="Any CPU" ``` -------------------------------- ### Load Decompiler NuGet Package Source: https://github.com/icsharpcode/ilspy/blob/master/decompiler-nuget-demos.ipynb Installs the ICSharpCode.Decompiler NuGet package and prints its version. Ensure the .NET Interactive Notebooks extension is installed in VS Code. ```python #r "nuget: ICSharpCode.Decompiler, 8.1.0.7455" using System.Reflection.Metadata; using ICSharpCode.Decompiler; using ICSharpCode.Decompiler.CSharp; using ICSharpCode.Decompiler.Metadata; using ICSharpCode.Decompiler.TypeSystem; Console.WriteLine(typeof(FullTypeName).Assembly.GetName()); ``` -------------------------------- ### Select Language Example Source: https://github.com/icsharpcode/ilspy/blob/master/doc/Command Line.txt Selects the desired output language for ILSpy. Supported languages include C# and IL (Intermediate Language). ```bash ILSpy --language:C# ``` ```bash ILSpy --language:IL ``` -------------------------------- ### Install ILSpy via Homebrew Cask Source: https://github.com/icsharpcode/ilspy/blob/master/BuildTools/packaging/homebrew/README.md Users can install ILSpy on macOS by adding the ILSpy tap and then installing the cask. This command assumes the tap 'icsharpcode/ilspy' is already added. ```bash brew install --cask icsharpcode/ilspy/ilspy ``` -------------------------------- ### Build ILSpy Binaries for ARM64 Source: https://github.com/icsharpcode/ilspy/blob/master/ILSpy.Installer/README.md Builds the ILSpy installer solution for the 'Release' configuration targeting 'Any CPU' platform, with ARM64 defined constants. This is used for building ARM64 specific versions. ```bash msbuild ILSpy.Installer.sln /p:Configuration="Release" /p:Platform="Any CPU" /p:DefineConstants="ARM64" ``` -------------------------------- ### Navigate to Member Example Source: https://github.com/icsharpcode/ilspy/blob/master/doc/Command Line.txt Navigates to a specific member within the provided assemblies using its ID string. The member is searched for only in the assemblies specified on the command line. ```bash ILSpy ILSpy.exe --navigateTo:T:ICSharpCode.ILSpy.CommandLineArguments ``` -------------------------------- ### Select language using command line Source: https://github.com/icsharpcode/ilspy/wiki/Command-Line-Arguments The /language option allows you to specify the desired display language for ILSpy. Examples include C# or IL (Intermediate Language). ```bash ILSpy /language:C# ``` ```bash ILSpy /language:IL ``` -------------------------------- ### Run Interactive ILSpyCmd Docker Container Source: https://github.com/icsharpcode/ilspy/blob/master/ICSharpCode.ILSpyCmd/AsContainer/README.md Starts an interactive Docker container based on the ILSpyCmd image. Mounts the current directory to allow access to files within the container. ```bash docker run --rm -it -v ./:/docker ilspycmd:91interactive ``` -------------------------------- ### Search Term Example Source: https://github.com/icsharpcode/ilspy/blob/master/doc/Command Line.txt Searches for types, members, or constants. Supports exact match (=term), exclusion (-term), inclusion (+term), and regular expressions. ```bash ILSpy --search:t:/Type(Name)?/... ``` -------------------------------- ### ILAst Block for Complex Nested Patterns Source: https://github.com/icsharpcode/ilspy/blob/master/doc/ILAst Pattern Matching.md Shows the IL transformation for a complex nested pattern involving type, variable, constant, and recursive patterns. This example demonstrates matching against properties and nested structures. ```text Block (TypePattern) { stloc z(isinst C(expr)) final: (z != null) && Block(VarPattern) { stloc x(z.A) final: ldc.i4 1 } && comp (z.B == 42) && Block(RecursivePattern) { stloc temp2(z.C) final: (temp2 != null) && comp (temp2.A == 4) } } ``` -------------------------------- ### Retrieve Captured Nodes from a Match Source: https://github.com/icsharpcode/ilspy/blob/master/doc/Pattern Matching.html After a successful pattern match, this code shows how to retrieve nodes stored in capture groups using the Get method and then modify them, for example, replacing a type with 'var'. ```C# if (m.Success) { m.Get("type").Single().ReplaceWith(new SimpleType("var")); } ``` -------------------------------- ### Control ILSpy via WM_COPYDATA message Source: https://github.com/icsharpcode/ilspy/wiki/Command-Line-Arguments Other programs can control ILSpy by sending a WM_COPYDATA message. The message data must be a UTF-16 string starting with 'ILSpy:\r\n', with subsequent lines treated as command-line arguments. This example shows how to open an assembly and navigate to a type. ```text ILSpy: C:\Assembly.dll /navigateTo:T:Type ``` -------------------------------- ### Publish .NET Core Application with ReadyToRun Source: https://github.com/icsharpcode/ilspy/wiki/ILSpy.ReadyToRun Use this command to publish a .NET Core application with ReadyToRun compilation enabled. This prepares the binaries for inspection with ILSpy.ReadyToRun. ```bash dotnet publish -r win-x64 /p:PublishReadyToRun=true ``` -------------------------------- ### ILSPYCMD Help Output Source: https://github.com/icsharpcode/ilspy/blob/master/ICSharpCode.ILSpyCmd/README.md Displays the help information for the ilspycmd tool, outlining its version, description, usage, arguments, and available options. ```bash ilspycmd --help ``` -------------------------------- ### Get Types in a Namespace Source: https://github.com/icsharpcode/ilspy/wiki/Getting-Started-With-ICSharpCode.Decompiler Access the collection of types within a specific namespace. The first namespace is typically ICSharpCode.Decompiler.TypeSystem. ```csharp // ICSharpCode.Decompiler.TypeSystem is the first namespace var typesInNamespace = icsdns.ChildNamespaces.First().Types; ``` -------------------------------- ### Build ILSpy Project Source: https://github.com/icsharpcode/ilspy/blob/master/CLAUDE.md Build the ILSpy solution using this script. Specify the configuration (Debug or Release) as needed. Use `--no-restore` if packages have already been restored. ```powershell build.ps1 -Configuration Debug ``` ```powershell build.ps1 -Configuration Release ``` ```powershell build.ps1 --no-restore ``` -------------------------------- ### MSFt RLE Wrapper - Compression and Decompression Source: https://github.com/icsharpcode/ilspy/blob/master/doc/ImageListFormat.md Demonstrates the compression and decompression logic using the MSFt RLE wrapper. The decompression includes an early-out check for the 'MSFt' header. ```csharp private static ReadOnlySpan HeaderMagic => "MSFt"u8; // 0x4D 0x53 0x46 0x74 // Compress writer.TryWrite(HeaderMagic); RunLengthEncoder.TryEncode(input, writer.Span[writer.Position..], out int written); // Decompress — note the early-out: if (!reader.TryAdvancePast(HeaderMagic)) { return input; } RunLengthEncoder.TryDecode(remaining, output, out int written); ``` -------------------------------- ### Get Child Namespaces Source: https://github.com/icsharpcode/ilspy/wiki/Getting-Started-With-ICSharpCode.Decompiler Iterate through the child namespaces of the root namespace to discover available namespaces within the assembly. ```csharp var icsdns = decompiler.TypeSystem.RootNamespace; foreach (var ns in icsdns.ChildNamespaces) Console.WriteLine(ns.FullName); ``` -------------------------------- ### Response File Usage Source: https://github.com/icsharpcode/ilspy/blob/master/doc/Command Line.txt Use a response file to pass arguments when the list of assemblies is too long for the command line. Each argument should be on a new line. ```text * The response file should contain the arguments, one argument per line (not space-separated!). * Use it when the list of assemblies is too long to fit on the command line. ``` -------------------------------- ### Get Type Count Source: https://github.com/icsharpcode/ilspy/blob/master/decompiler-nuget-demos.ipynb Retrieves and prints the total count of type definitions within the loaded assembly's type system. ```python var types = decompiler.TypeSystem.MainModule.TypeDefinitions; Console.WriteLine(types.Count()); ``` -------------------------------- ### Basic ILSpy Command Line Usage Source: https://github.com/icsharpcode/ilspy/blob/master/doc/Command Line.txt Specifies the assemblies to load and optional arguments for ILSpy. Use a response file for extensive assembly lists. ```bash Usage: [options] @ResponseFile.rsp ``` -------------------------------- ### Get Types in Namespace Source: https://github.com/icsharpcode/ilspy/blob/master/decompiler-nuget-demos.ipynb Retrieves and prints the full type name of the first type found within a specified namespace (e.g., 'LightJson'). ```python var typesInNamespace = icsdns.ChildNamespaces.First(cn => cn.FullName == "LightJson").Types; Console.WriteLine(typesInNamespace.First().FullTypeName); ``` -------------------------------- ### Build Project Source: https://github.com/icsharpcode/ilspy/blob/master/CLAUDE.md After making edits to matchers or rewriters, it is crucial to run the relevant tests, not just the build. A green build does not guarantee correct behavior. ```bash dotnet build ``` -------------------------------- ### Initialize CSharpDecompiler Source: https://github.com/icsharpcode/ilspy/wiki/Getting-Started-With-ICSharpCode.Decompiler Create an instance of CSharpDecompiler to begin the decompilation process. Ensure the assembly file exists. ```csharp var decompiler = new CSharpDecompiler(fileName, new DecompilerSettings()); ``` -------------------------------- ### NameEntry Structure Source: https://github.com/icsharpcode/ilspy/blob/master/doc/Resources.txt Defines the structure for name entries, which include the length and UTF-16 encoded name, followed by the data offset. This entry is found relative to the start of the remainderOfFile array. ```C# // NameEntry #i is stored starting at remainderOfFile[namePositions[i]] // (that is, namePositions is interpreted relative to the start of the remainderOfFile array) struct NameEntry { compressedint len; byte name[len]; // interpret as UTF-16 int32 dataOffset; [check >= 0] } ``` -------------------------------- ### Get Method Body Block from IMethod Source: https://github.com/icsharpcode/ilspy/wiki/srm Retrieves the MethodBodyBlock for a given IMethod. Returns null if the method has no body or an invalid metadata token. Ensure the IMethod is valid and belongs to a PEFile. ```csharp public MethodBodyBlock GetMethodBody(IMethod method) { if (!method.HasBody || method.MetadataToken.IsNil) return null; var module = method.ParentModule.PEFile; var md = module.Metadata.GetMethodDefinition((MethodDefinitionHandle)method.MetadataToken); return module.Reader.GetMethodBody(md.RelativeVirtualAddress); } ``` -------------------------------- ### Decompile Assembly to Directory with Project File (One File Per Type) Source: https://github.com/icsharpcode/ilspy/blob/master/ICSharpCode.ILSpyCmd/README.md Decompiles a DLL, creates a project file, and generates one C# source file for each type within the assembly, saving them to a specified directory. ```bash ilspycmd -p -o c:\decompiled sample.dll ``` -------------------------------- ### Run Test Suite with TRX Report Source: https://github.com/icsharpcode/ilspy/blob/master/CLAUDE.md Always run the test suite with `--report-trx` to ensure failures are preserved. The repository pins Microsoft.Testing.Platform in global.json, so use the specified command format. ```bash dotnet test --solution ILSpy.sln --report-trx ``` -------------------------------- ### Build Interactive ILSpyCmd Docker Image Source: https://github.com/icsharpcode/ilspy/blob/master/ICSharpCode.ILSpyCmd/AsContainer/README.md Builds a Docker image for interactive use of ILSpyCmd. This is useful for exploring .NET assemblies directly within a container. ```bash docker build -t ilspycmd:91interactive . -f Dockerfile ``` -------------------------------- ### Define a Binary Operator Expression Node Source: https://github.com/icsharpcode/ilspy/blob/master/ICSharpCode.Decompiler/CSharp/Syntax/README.md This example shows how to declare a C# AST node using attributes. The `DecompilerAstNode` attribute marks the class as a syntax tree node, and `Slot` attributes define its children. Scalar properties are declared as regular auto-properties. ```csharp [DecompilerAstNode] public sealed partial class BinaryOperatorExpression : Expression { [Slot("Left")] public partial Expression? Left { get; set; } // a child slot (optional: nullable) public BinaryOperatorType Operator { get; set; } // a scalar -- a plain auto-property [Slot("Right")] public partial Expression? Right { get; set; } // another child slot } ``` -------------------------------- ### Format ILSpy Solution Source: https://github.com/icsharpcode/ilspy/blob/master/CLAUDE.md This script formats the entire solution according to project standards. It is automatically run by the pre-commit hook. ```powershell BuildTools/format.ps1 ``` -------------------------------- ### Decompile Assembly to Directory with Nested Directories Source: https://github.com/icsharpcode/ilspy/blob/master/ICSharpCode.ILSpyCmd/README.md Similar to the previous command, but organizes the decompiled source files into nicely nested directories within the output folder. ```bash ilspycmd --nested-directories -p -o c:\decompiled sample.dll ``` -------------------------------- ### Generate HTML Diagrammer (All Type Info) Source: https://github.com/icsharpcode/ilspy/blob/master/ICSharpCode.ILSpyCmd/README.md Generates an HTML diagrammer containing all type information for the specified assembly. The output folder is created next to the input assembly. ```bash ilspycmd sample.dll --generate-diagrammer ``` -------------------------------- ### Navigate to a specific type using command line Source: https://github.com/icsharpcode/ilspy/wiki/Command-Line-Arguments Use the /navigateTo option to open a specific assembly and navigate to a given member ID. The ID string format is described in appendix A of the C# language specification. ```bash ILSpy /navigateTo:T:ICSharpCode.ILSpy.CommandLineArguments ``` -------------------------------- ### UIntPtr Construction Primitives Source: https://github.com/icsharpcode/ilspy/blob/master/doc/IntPtr.txt Methods for constructing UIntPtr from various unsigned integer types and void pointers, along with their equivalent IL operations. ```csharp new UIntPtr(uint) equivalent to: conv u4->u ``` ```csharp new UIntPtr(ulong) equivalent to: conv.ovf u8->u ``` ```csharp new UIntPtr(void*) equivalent to: nop ``` -------------------------------- ### Initialize C# Decompiler Source: https://github.com/icsharpcode/ilspy/blob/master/decompiler-nuget-demos.ipynb Initializes the C# decompiler with a specified assembly path. Ensure ILSpy.XPlat.slnf is compiled first and basePath is set to your repository path. ```python const string basePath = @"D:\GitWorkspace\ILSpy\"; string testAssemblyPath = basePath + @"ICSharpCode.Decompiler.PowerShell\bin\Release\netstandard2.0\ICSharpCode.Decompiler.dll"; var decompiler = new CSharpDecompiler(testAssemblyPath, new DecompilerSettings()); ``` -------------------------------- ### Exporting a Main Menu Command Source: https://github.com/icsharpcode/ilspy/blob/master/TestPlugin/Readme.txt Add a new command to ILSpy's main menu. Ensure the command class implements WPF's ICommand interface. Icons must be embedded as resources. ```csharp [ExportMainMenuCommand(Menu = "_File", MenuIcon = "Clear.png", Header = "_Clear List", MenuCategory = "Open", MenuOrder = 1.5)] public class UnloadAllAssembliesCommand : SimpleCommand ``` -------------------------------- ### Build ILSpyCmd Docker Image for Automation Source: https://github.com/icsharpcode/ilspy/blob/master/ICSharpCode.ILSpyCmd/AsContainer/README.md Builds a Docker image specifically for automating ILSpyCmd tasks. This image is optimized for running ILSpyCmd as part of a CI/CD pipeline or script. ```bash docker build -t ilspycmd:91forautomation . -f DockerfileForAutomation ``` -------------------------------- ### Create ILSpy macOS DMG Source: https://github.com/icsharpcode/ilspy/blob/master/BuildTools/packaging/macos/README.md Use this script to build, sign, and notarize the ILSpy application DMG. Omit signing and notarization flags for local testing. ```powershell ./create-dmg.ps1 -AppPath ./ILSpy.app -Version \ -SigningIdentity 'Developer ID Application: ()' \ -Notarize -NotaryProfile ``` -------------------------------- ### IntPtr Construction Primitives Source: https://github.com/icsharpcode/ilspy/blob/master/doc/IntPtr.txt Methods for constructing IntPtr from various integer types and void pointers, along with their equivalent IL operations. ```csharp new IntPtr(int) equivalent to: conv i4->i ``` ```csharp new IntPtr(long) equivalent to: conv.ovf i8->i ``` ```csharp new IntPtr(void*) equivalent to: nop ``` -------------------------------- ### List Embedded Resources in Assembly Source: https://github.com/icsharpcode/ilspy/blob/master/ICSharpCode.ILSpyCmd/README.md Lists all embedded resources within a WPF assembly, including BAML entries contained within .g.resources files. ```bash ilspycmd sample.dll --list-resources ``` -------------------------------- ### Specify Custom XML Documentation File Names Source: https://github.com/icsharpcode/ilspy/blob/master/ICSharpCode.ILSpyCmd/README.md If your XML documentation files have custom names, specify the custom path using the `--generate-diagrammer-docs` option. ```bash ilspycmd.exe --generate-diagrammer-docs ..\path\to\your\docs.xml ..\path\to\your\assembly.dll --generate-diagrammer --output-folder . ``` -------------------------------- ### Decompile Assembly to Directory (Single C# File) Source: https://github.com/icsharpcode/ilspy/blob/master/ICSharpCode.ILSpyCmd/README.md Decompiles a DLL and saves the output to a specified directory, creating a single C# file for the entire assembly. ```bash ilspycmd -o c:\decompiled sample.dll ``` -------------------------------- ### Decompile NuGet Packages with ilspycmd Source: https://github.com/icsharpcode/ilspy/blob/master/CLAUDE.md Use the `ilspycmd` tool provided with this repository to decompile NuGet packages and inspect their internals, rather than grepping binaries. ```bash ilspycmd ``` -------------------------------- ### Generate HTML Diagrammer with CMD Script Source: https://github.com/icsharpcode/ilspy/blob/master/ICSharpCode.ILSpyCmd/README.md Use this CMD script to manually regenerate an HTML diagrammer from a .NET assembly. Ensure the output directory is created beforehand. ```shell "../../path/to/ilspycmd.exe" ../path/to/your/assembly.dll --generate-diagrammer --outputdir . ``` -------------------------------- ### Exporting a Toolbar Command Source: https://github.com/icsharpcode/ilspy/blob/master/TestPlugin/Readme.txt Integrate a new command into ILSpy's toolbar. The command class must implement WPF's ICommand interface. Icons need to be embedded as resources. ```csharp [ExportToolbarCommand(ToolTip = "Clears the current assembly list", ToolbarIcon = "Clear.png", ToolbarCategory = "Open", ToolbarOrder = 1.5)] public class UnloadAllAssembliesCommand : SimpleCommand ``` -------------------------------- ### Writing ImageList Data to Stream Source: https://github.com/icsharpcode/ilspy/blob/master/doc/ImageListFormat.md Demonstrates the sequence of writing the ILHEAD structure, the color DIB, and optionally the mask DIB to an IStream. This is the core logic for serializing an image list. ```csharp IStream_Write(pstm, &ilHead, sizeof(ILHEAD), NULL); _write_bitmap(himl->hbmImage, pstm); // color DIB if (himl->flags & ILC_MASK) _write_bitmap(himl->hbmMask, pstm); // monochrome mask DIB ``` -------------------------------- ### Add Usings for ICSharpCode.Decompiler Source: https://github.com/icsharpcode/ilspy/wiki/Getting-Started-With-ICSharpCode.Decompiler Include these usings to access the necessary classes for decompilation. ```csharp using ICSharpCode.Decompiler; using ICSharpCode.Decompiler.CSharp; using ICSharpCode.Decompiler.TypeSystem; ``` -------------------------------- ### Update Dependencies and Regenerate Lock Files Source: https://github.com/icsharpcode/ilspy/blob/master/CLAUDE.md Run this script to update dependencies and regenerate `packages.lock.json` files. This should be done after adding or updating package references. ```powershell updatedeps.ps1 ``` -------------------------------- ### Exporting an Option Page Source: https://github.com/icsharpcode/ilspy/blob/master/TestPlugin/Readme.txt Create a custom option page for ILSpy. The class should inherit from UserControl and implement the IOptionPage interface. ```csharp [ExportOptionPage("TestPlugin")] partial class CustomOptionPage : UserControl, IOptionPage ``` -------------------------------- ### ValueEntry Structure (Version 1) Source: https://github.com/icsharpcode/ilspy/blob/master/doc/Resources.txt Details the structure of a ValueEntry for version 1 of the ResourcesFile format. It includes a type index and handles various primitive types, DateTime, TimeSpan, decimal, and BinaryFormatter-serialized data. ```C# // Found at position ResourcesFileFormat.dataSectionOffset+NameEntry.dataOffset in the file. struct ValueEntry { if (version == 1) { compressedint typeIndex; if (typeIndex == -1) { // no value stored; value is implicitly null } else { switch (typeName[typeIndex]) { case string: case int, uint, long, ulong, sbyte, byte, short, ushort: case float: case double: T value; // value directly stored case DateTime: int64 value; // new DateTime(_store.ReadInt64()) case TimeSpan: int64 value; // new TimeSpan(_store.ReadInt64()) case decimal: int32 value[4]; default: byte data[...]; // BinaryFormatter-serialized data using typeName[typeIndex] } } } else if (version == 2) { compressedint typeCode; // note: unlike v1, no lookup into the typeName array! switch (typeCode) { case null: // no value stored; value is implicitly null case string: case bool: case int, uint, long, ulong, sbyte, byte, short, ushort: T value; case char: uint16 value; case float: case double: case decimal: T value; case DateTime: int64 value; // DateTime.FromBinary(_store.ReadInt64()) case TimeSpan: int64 value; // new TimeSpan(_store.ReadInt64()) case ResourceTypeCode.ByteArray: int32 len; byte value[len]; case ResourceTypeCode.Stream: int32 len; byte value[len]; case >= ResourceTypeCode.StartOfUserTypes: byte data[...]; // BinaryFormatter-serialized data using typeName[typeCode - ResourceTypeCode.StartOfUserTypes] } } } ``` -------------------------------- ### List Root Namespaces Source: https://github.com/icsharpcode/ilspy/blob/master/decompiler-nuget-demos.ipynb Iterates through and prints the full names of all direct child namespaces within the root namespace of the decompiled assembly. ```python var icsdns = decompiler.TypeSystem.RootNamespace; foreach (var cn in icsdns.ChildNamespaces) Console.WriteLine(cn.FullName); ``` -------------------------------- ### Decompile Assembly as Project and Convert BAML to XAML Source: https://github.com/icsharpcode/ilspy/blob/master/ICSharpCode.ILSpyCmd/README.md Decompiles an assembly as a compilable project and converts all embedded BAML resources into XAML Page items. ```bash ilspycmd sample.dll -p -o c:\decompiled --decompile-baml ``` -------------------------------- ### Integrate HTML Diagrammer Generation into MSBuild Post-Build Event Source: https://github.com/icsharpcode/ilspy/blob/master/ICSharpCode.ILSpyCmd/README.md Add this MSBuild target to your project file to automatically regenerate the HTML diagrammer after a Release build. The diagrammer is output to the project's diagrammer directory. ```xml ``` -------------------------------- ### Restore ILSpy Project Source: https://github.com/icsharpcode/ilspy/blob/master/CLAUDE.md Use this script to restore NuGet packages, ensuring lock files are not pruned. This is crucial for maintaining repository consistency. ```powershell restore.ps1 ``` -------------------------------- ### Decompile Assembly to Console Output Source: https://github.com/icsharpcode/ilspy/blob/master/ICSharpCode.ILSpyCmd/README.md Use this command to decompile a DLL and display the decompiled C# code directly in the console. ```bash ilspycmd sample.dll ``` -------------------------------- ### Force Evaluate NuGet Lock Files Source: https://github.com/icsharpcode/ilspy/blob/master/CLAUDE.md This command forces a re-evaluation of NuGet lock files, ensuring they are up-to-date. It's used in conjunction with `dotnet restore` and specific parameters to prevent pruning. ```bash dotnet restore ILSpy.sln --force-evaluate -p:RestoreEnablePackagePruning=false ``` -------------------------------- ### Inspect Jitted Disassembly with COMPLUS_JitDump Source: https://github.com/icsharpcode/ilspy/wiki/ILSpy.ReadyToRun This environment variable can be used to inspect the jitted disassembly of .NET code. It is useful for comparing with ReadyToRun compiled code to understand performance differences. ```bash COMPLUS_JitDump ``` -------------------------------- ### Exporting a Context Menu Entry Source: https://github.com/icsharpcode/ilspy/blob/master/TestPlugin/Readme.txt Add a new entry to ILSpy's context menus. The entry must implement the IContextMenuEntry interface, which defines IsVisible, IsEnabled, and Execute methods. ```csharp [ExportContextMenuEntry(Header = "_Save Assembly")] public class SaveAssembly : IContextMenuEntry ```