Skip to content

Latest commit

 

History

History
156 lines (108 loc) · 4.14 KB

File metadata and controls

156 lines (108 loc) · 4.14 KB
external help file Module Name online version schema
ISpy.dll-Help.xml
ISpy
2.0.0

Export-DecompiledSource

SYNOPSIS

Exports decompiled C# source code from .NET assemblies to organized file structures with advanced bulk processing capabilities.

SYNTAX

Export-DecompiledSource [-Path] <String> [-OutputDirectory] <String> [-TypeNames <String[]>]
 [-Namespace <String>] [-CreateNamespaceDirectories] [-Settings <DecompilerSettings>] [-Decompiler <CSharpDecompiler>] [-Force]
 [<CommonParameters>]

DESCRIPTION

The Export-DecompiledSource cmdlet provides powerful bulk decompilation capabilities for .NET assemblies. It efficiently processes large assemblies by decompiling types individually and organizing the resulting C# source code into well-structured directory hierarchies.

EXAMPLES

Example 1: Export a library to a folder

PS C:\> Export-DecompiledSource -Path "$PSHOME/Humanizer.dll" -OutputPath ".\Decompiled"

This command decompiles Humanizer.dll and writes per-type source files into the .\Decompiled directory.

Example 2: Export a specific set of types

PS C:\> Export-DecompiledSource -Path "$PSHOME/Humanizer.dll" -OutputPath ".\Decompiled" -TypeNames @(
    'Humanizer.NumberToWordsExtension',
    'Humanizer.InflectorExtensions'
  )

This command decompiles only the listed fully-qualified types and writes them to the output folder.

Example 3: Create namespace directories and overwrite existing files

PS C:\> Export-DecompiledSource -Path "$PSHOME/Humanizer.dll" -OutputPath ".\Decompiled" -CreateNamespaceDirectories -Force

This command creates directories matching each type's namespace and overwrites any existing files in the target directory.

Example 4: Export with a custom decompiler instance

PS C:\> $decompiler = New-Decompiler -Path "$PSHOME/Humanizer.dll"
PS C:\> Export-DecompiledSource -Path "$PSHOME/Humanizer.dll" -OutputPath ".\Decompiled" -TypeNames @('Humanizer.NumberToWordsExtension') -Decompiler $decompiler

This command reuses a pre-created decompiler to export selected types.

PARAMETERS

-Path

Specifies the path to the .NET assembly file to decompile and export. This can be a DLL, EXE, or any valid .NET assembly format.

Type: String
Parameter Sets: (All)
Aliases: PSPath, Path

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-OutputPath

Specifies the root directory where decompiled source files will be exported. The directory will be created if it doesn't exist.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-TypeNames

Specifies an array of specific type names to export. If not provided, all types in the assembly will be exported. Use full type names including namespace.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: All types in assembly
Accept pipeline input: False
Accept wildcard characters: False

-Settings

Custom DecompilerSettings used when creating a decompiler.

Type: DecompilerSettings
Required: False
Position: Named
Accept pipeline input: False

-Decompiler

Custom CSharpDecompiler instance to use directly.

Type: CSharpDecompiler
Required: False
Position: Named
Accept pipeline input: False

INPUTS

System.String

OUTPUTS

ISpy.Models.ISpyExportResult

Returns an ISpyExportResult object containing information about exported files.

NOTES

  • Use -TypeNames to export only specific types.
  • Use -CreateNamespaceDirectories to mirror namespaces in the output folder structure.
  • Use -Force to overwrite existing files.

RELATED LINKS

Get-DecompiledSource Get-AssemblyInfo Get-Type