Skip to content

Conversation

@k-o-n-t-o-r
Copy link

Feature: Export Decompiled Code to Disk

This PR adds a new command, ILSpy: Export Decompiled Code..., which exports all decompiled types from a selected (loaded) assembly to a user-specified folder while preserving namespace-based directory structure.

The export runs with progress + cancellation support, writes AssemblyInfo.cs/AssemblyInfo.il at the root, and reports any decompilation errors at the end.

The command is available from the assembly node context menu in the ILSpy: Assemblies view and via the command palette when assemblies are loaded.


Screenshot_20260106_155332 Screenshot_20260106_155108

return s.endsWith("\n") ? s : `${s}\n`;
}

function sanitizePathSegment(segment: string) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please have a look at WholeProjectDecompiler.SanitizeFileName, because I think you are missing some special cases, especially, your code is not checking the length of the individual segments.

See https://github.com/icsharpcode/ILSpy/blob/master/ICSharpCode.Decompiler/CSharp/ProjectDecompiler/WholeProjectDecompiler.cs#L641

);

try {
await vscode.window.withProgress(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not reuse WholeProjectDecompiler instead of reinventing it in JavaScript?

@k-o-n-t-o-r
Copy link
Author

Moved most of the logic into the backend and am now using WholeProjectDecompiler.

@siegfriedpammer
Copy link
Member

What's the reason for disabling the generation of a project file? It seems odd to me to create a bunch of C# source code files without a project file.

@k-o-n-t-o-r
Copy link
Author

Sorry, forgot to remove this. Better now?

@siegfriedpammer
Copy link
Member

Yes, thanks a lot!

@Rpinski it's your turn now 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants