.NET Decompiler with support for PDB generation, ReadyToRun, Metadata (&more) - cross-platform!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
tom-englert 560d89a42f Get rid of singletons, replace with DI: MainWindow, Settings and Language service 6 months ago
..
Properties Upgrade dotnet-format from version 5 to the version included with the .NET (6) SDK. 3 years ago
AboutPageAddition.cs Get rid of the heavy System.ComponentModel.Composition, replace with the lightweight System.Composition.AttributedModel 6 months ago
Clear.png Add TestPlugin. 14 years ago
ContextMenuCommand.cs Get rid of the heavy System.ComponentModel.Composition, replace with the lightweight System.Composition.AttributedModel 6 months ago
CustomLanguage.cs Get rid of the heavy System.ComponentModel.Composition, replace with the lightweight System.Composition.AttributedModel 6 months ago
CustomOptionPage.xaml Consolidate all options/settings to use a consistent WFP MVVM pattern. 8 months ago
CustomOptionPage.xaml.cs Get rid of the heavy System.ComponentModel.Composition, replace with the lightweight System.Composition.AttributedModel 6 months ago
MainMenuCommand.cs Get rid of singletons, replace with DI: MainWindow, Settings and Language service 6 months ago
Readme.txt Get rid of the heavy System.ComponentModel.Composition, replace with the lightweight System.Composition.AttributedModel 6 months ago
TestPlugin.csproj Remove dangling project references for SharpTreeView (#3245) 9 months ago

Readme.txt

ILSpy uses MEF (Managed Extensibility Framework) for plugins.
Plugins must be placed in the same directory as ILSpy.exe, and must be called "*.Plugin.dll".

To write a plugin, you need to add a reference to ILSpy.exe and to System.Composition.AttributedModel.
Depending on what your plugin is doing, you might also need references to the other libraries shipping with ILSpy.

Plugins work by exporting types for certain extension points.
Here is a list of extension points:

Adding another language:

[Export(typeof(Language))]
public class CustomLanguage : Language

This adds an additional language to the combobox in the toolbar.
The language has to implement its own decompiler (all the way from IL), but it can also re-use
the ICSharpCode.Decompiler library to decompile to C#, and then translate the C# code to the target language.

---

Adding an entry to the main menu:

[ExportMainMenuCommand(Menu = "_File", MenuIcon = "Clear.png", Header = "_Clear List", MenuCategory = "Open", MenuOrder = 1.5)]
public class UnloadAllAssembliesCommand : SimpleCommand

Menu: menu into which the item is added
MenuIcon: optional, icon to use for the menu item. Must be embedded as "Resource" (WPF-style resource) in the same assembly as the command type.
Header: text on the menu item
MenuCategory: optional, used for grouping related menu items together. A separator is added between different groups.
MenuOrder: controls the order in which the items appear (items are sorted by this value)

The command class must implement WPF's ICommand interface.

---

Adding an entry to the tool bar:

[ExportToolbarCommand(ToolTip = "Clears the current assembly list", ToolbarIcon = "Clear.png", ToolbarCategory = "Open", ToolbarOrder = 1.5)]
public class UnloadAllAssembliesCommand : SimpleCommand

ToolTip: the tool tip
ToolbarIcon: The icon. Must be embedded as "Resource" (WPF-style resource) in the same assembly as the command type.
ToolbarCategory: optional, used for grouping related toolbar items together. A separator is added between different groups.
ToolbarOrder: controls the order in which the items appear (items are sorted by this value)

The command class must implement WPF's ICommand interface.

---

Adding an entry to the context menu:

[ExportContextMenuEntry(Header = "_Save Assembly")]
public class SaveAssembly : IContextMenuEntry

Icon: optional, icon to use for the menu item. Must be embedded as "Resource" (WPF-style resource) in the same assembly as the command type.
Header: text on the menu item
Category: optional, used for grouping related menu items together. A separator is added between different groups.
Order: controls the order in which the items appear (items are sorted by this value)

Context menu entries must implement IContextMenuEntry, which defines 3 methods:
bool IsVisible, bool IsEnabled, and void Execute.

---

Adding an option page:

[ExportOptionPage("TestPlugin")]
partial class CustomOptionPage : UserControl, IOptionPage