Commit Graph
67 Commits
Author SHA1 Message Date
Siegfried Pammer 74bc61b70f ilspycmd: add --member for single-member decompilation
Decompiling one method or property previously required decompiling its
whole type and searching the output, which is wasteful for scripted and
agent-driven use against large assemblies. The new -m|--member option
accepts an XML documentation id string (the syntax of compiler-generated
documentation files and of the UI's --navigateto option) or a metadata
token in 0x06000005 form, resolves it against the main module (with a
bounds check for tokens and distinct error messages for malformed ids,
unknown members, and members of other modules), and prints just that
member through the engine's single-member decompilation path.

The tests seed a new ICSharpCode.ILSpyCmd.Tests project (part of the
XPlat and Desktop solution filters and of the per-project CI test
steps), driving the real Main in-process via InternalsVisibleTo, so
future ilspycmd features have a dedicated home for CLI tests.

Assisted-by: Claude:claude-fable-5:Claude Code
2026-07-28 14:25:04 +02:00
Christoph Wille b888153f24 NuGet 07/26 updates and .NET 11 P6 Roslyn 2026-07-14 20:46:08 +02:00
Siegfried Pammer 07d5a01d2b Add license headers to source files that lacked them
Backfills the standard MIT X11 header on hand-written files that never
got one, attributing each to its first-commit author and year from git
history. Code vendored from dotnet/runtime and Humanizr/Humanizer gets
its origin's license lines and a provenance note instead. Generated
files (Resources.Designer.cs, the version-info template), tool-managed
suppression files, and BAML test-case fixtures intentionally stay
header-less.

Assisted-by: Claude:claude-fable-5:Claude Code
2026-07-05 21:09:46 +02:00
Siegfried Pammer 17b3539a20 Add a per-assembly target-framework override for reference resolution
ILSpy resolves an assembly's references against the target framework it
detects from the TargetFrameworkAttribute. When that attribute is missing,
wrong, or the user wants to force a different framework, there was no way to
hint the correct one, so references could resolve against the wrong runtime
pack or framework directory.

A LoadedAssembly can now carry a TargetFrameworkIdOverride that short-circuits
detection (it is the single value every LoadedAssembly-based resolution path
reads), is persisted in the assembly-list XML, and is carried across a reload
so a runtime change re-resolves against the new framework. The "Set Target
Framework" context-menu entry edits it through a dialog with a free-form text
box and an always-visible list of common monikers to pick from (the app forces
overlay popups, so a dropdown would be clamped inside the small dialog); input
is validated and converted from the short TFM users know (net48) to the long
FrameworkName form the resolver consumes (.NETFramework,Version=v4.8) via
NuGet. The direct DetectTargetFrameworkId callers in the decompiler core
(project export, language version) intentionally keep reading the real
attribute; only reference resolution is overridden.

Resurrects a 2020 prototype (branch tfmoverride) re-implemented against the
current ILSpyX/Avalonia code, whose surrounding structures no longer matched.

Assisted-by: Claude:claude-opus-4-8:Claude Code
2026-07-01 05:50:11 +02:00
Siegfried Pammer 53498c5691 Fix #3797: resolve ilspycmd -t type names with fuzzy matching
--list-* printed generic types without their `n arity suffix, yet -t only
accepted the exact reflection name, so a name copied straight from the listing
threw "Could not find type definition". The listing now prints the reflection
name, and -t resolves through a ladder of progressively looser, uniqueness-
checked rules: the engine's exact lookup, an arity- and nesting-separator-
insensitive FullName match, a case-insensitive match, a namespace-less simple
name, and a trailing segment path ("Dictionary.KeyCollection"). The input is
parsed with System.Reflection.Metadata.TypeName and reduced to its underlying
definition first, so assembly qualification, generic arguments, and
array/pointer/byref decorations cannot corrupt the comparison key. An ambiguous
name reports its candidates instead of guessing, and a miss prints name
suggestions and returns EX_DATAERR rather than dumping a stack trace.

Assisted-by: Claude:claude-opus-4-8:Claude Code
2026-06-22 19:42:14 +02:00
Christoph Wille da57bad452 Merge pull request #3758 from icsharpcode/christophwille/nu0626
NuGet June 2026 Updates
2026-06-10 16:21:11 +02:00
Siegfried Pammer 87748e0cde Override vulnerable transitive packages from the DiaSymReader chain
The Microsoft.DiaSymReader / .PortablePdb packages pull NETStandard.Library
1.6.1, which drags in 4.3.0 builds of System.Net.Http, System.Private.Uri
and System.Text.RegularExpressions, all carrying known advisories (NU1902/
NU1903). They are framework-provided at runtime on net10.0; pin the patched
4.3.4 / 4.3.2 / 4.3.1 via central transitive pinning so NuGet audit passes.
Enabling transitive pinning also aligns a handful of other transitive
packages to their declared central versions.

Assisted-by: Claude:claude-opus-4-8:Claude Code
2026-06-10 00:11:56 +02:00
Siegfried Pammer 667f6ad5f8 Add pwsh dev scripts, repo-wide lock files, and CI NuGet caching
Replace the Windows-only .bat helpers (clean / debugbuild / releasebuild /
restore / updatedeps and BuildTools/format) with cross-platform pwsh
scripts at the repo root: restore.ps1, build.ps1 (-Configuration), clean.ps1,
updatedeps.ps1 and BuildTools/format.ps1, alongside the existing publish.ps1.

Enable a packages.lock.json for every project by hoisting
RestorePackagesWithLockFile into the root Directory.Build.props (the four
core libraries set it individually before) and commit the generated locks,
so restores are repeatable and CI can cache packages off them.

Cache the NuGet packages folder in the three setup-dotnet workflows
(build-ilspy, build-frontends, codeql-analysis), keyed on the lock files
per the setup-dotnet caching guidance.

Scope the Debug "Verify package contents" check to the *.filelist outputs
it actually generates. A project's packages.lock.json is keyed only by
(framework, RID), with no host-OS axis, so a lock produced on Linux
legitimately differs from one produced on Windows whenever an OS-conditional
PackageReference applies (Debug+Windows pulls Microsoft.DiaSymReader*). The
Windows restore then rewrites those locks; that churn must not fail a step
whose job is to police the VSIX/MSI file lists.

Also drop the dead ILSpy.BamlDecompiler publish line from
publishlocaldev.ps1, mirroring the earlier publish.ps1 fix.

Assisted-by: Claude:claude-opus-4-8:Claude Code
2026-06-09 00:58:19 +02:00
Siegfried Pammer d89bf8589b Make PortablePdbWriter an instance type with an embed-source option
The portable-PDB writer carried its knobs (no-logo, pdb id, progress,
progress title) as a growing list of optional WritePdb parameters.
Turn the type into a configured instance whose options are properties,
and add EmbedSourceFiles (default true): when a PDB is generated next
to a project export whose .cs are already on disk, embedding the source
again is redundant, so the caller can turn it off. The per-document
checksum/hash is computed either way, so documents still resolve.

Assisted-by: Claude:claude-opus-4-8:Claude Code
2026-06-08 18:34:56 +02:00
Siegfried Pammer e02097dccf Replace ISettingsFilePathProvider with Func<string> and move IResourceFileHandler to ILSpyX. 2026-06-08 07:34:42 +02:00
Christoph Wille 1a9807079d Fix typos in cmd line options help (ILSpyCmd) 2026-05-18 07:03:44 +02:00
Christoph Wille 5833ee57a4 Updates for .NET Preview 4 2026-05-13 08:32:01 +02:00
Christoph Wille 6cd4131d59 Update NuGet packages (vulnerable and basic) 2026-05-12 14:10:52 +02:00
Christoph Wille a41156ff1d Update ILSpyCmd README.md 2026-05-12 13:59:21 +02:00
Siegfried Pammer d5e2e61a90 ilspycmd: route update-check messages to stderr
stdout is the data channel: --resource may be writing a binary payload to
it. Update-check notices on stdout would tail-append to the binary stream
and corrupt extracted files. Move them to stderr (npm/cargo/pip
convention) so meta-output stays out of the data path.
2026-05-07 22:31:10 +02:00
Siegfried Pammer 28fffb7e2c ilspycmd: add --list-resources, --resource, and --decompile-baml
--list-resources prints every leaf in the assembly's embedded
resources (including individual entries inside .resources containers).

--resource <name> extracts a single leaf. Names ending in .baml are
decompiled to XAML; everything else is emitted as raw bytes. Without
-o, BAML goes to stdout as text and binary leaves go to the binary
stdout stream. Unknown names exit with EX_DATAERR and print the
available leaves to stderr.

--decompile-baml is a modifier for -p that swaps in the new
BamlAwareWholeProjectDecompiler so .baml entries become .xaml Page
items in the generated project. Default -p behaviour is unchanged.
2026-05-07 22:31:10 +02:00
Siegfried Pammer 50afc97e7b ilspycmd: add resource enumeration and BAML→XAML helpers
ResourceExtensions exposes the leaves of an assembly's embedded
resources — including individual entries inside .resources containers
— so callers can list and extract them by a stable path.

BamlAwareWholeProjectDecompiler subclasses WholeProjectDecompiler and
converts .baml entries to .xaml Page items, mirroring the pattern in
ILSpy.BamlDecompiler.BamlResourceFileHandler so PartialTypeInfo flows
through and the C# decompiler suppresses the duplicate Connect()
overrides.
2026-05-07 22:31:10 +02:00
Siegfried Pammer d3e9121a32 ilspycmd: reference ICSharpCode.BamlDecompiler 2026-05-06 17:21:27 +02:00
Christoph Wille f99b4a21a7 Nuget package updates 04/26 2026-04-14 20:01:48 +02:00
Christoph Wille e66bcc2cde Introduce version variables for often-used package version 2026-04-12 07:57:09 +02:00
Christoph Wille c0d26255fa .NET Update 10.0.4 to 10.0.5 (#3681) 2026-03-18 13:38:11 +01:00
Christoph Wille 2f311c233d Roslyn 5.3.0 (#3665)
NuGet updates 4/26 including Roslyn 5.3.0
2026-03-11 09:48:40 +01:00
Christoph Wille a1e2a4aa91 NuGet Update 02/26 (#3663)
* NuGet Update 02/26
* Update to latest build agent software
* Use Wix 6.0.2, manually install version-locked WixToolset.UI.wixext extension
2026-02-14 09:48:48 +01:00
Siegfried Pammer ceed812e3d Remove explicit PackageReference to NetAnalyzers again 2025-12-29 20:09:35 +01:00
Siegfried Pammer d3e12d0ebf Migrate from .ruleset to .editorconfig 2025-12-29 19:24:31 +01:00
Christoph Wille 1070b03468 NuGet December 2025 Updates (#3634) 2025-12-11 09:11:00 +01:00
sonyps5201314 193a463766 Support batch PDB generation. (#3619)
* Support batch PDB generation.

* Use `FileMode.Create` for output PDB files to ensure existing files are fully overwritten/truncated.

* Localize the string `Generating portable PDB...`.

* Refine `GeneratePdbForAssemblies` implementation.

* Replace direct calls to `explorer.exe` with the Shell API to prevent spawning an `explorer.exe` process that doesn't exit automatically on every call.

* Batch calls to `ShellHelper.OpenFolderAndSelectItems` instead of looping `OpenFolderAndSelectItem`.

* Localize the string `Open Explorer`.

* Fix `OpenCmdHere` malfunction when ILSpy is running from a different drive than the OS.

* Refine `GeneratePdbForAssemblies` implementation.

* Replace WinForms `FolderBrowserDialog` with WPF `OpenFolderDialog`.

* Add license header

* Exclude duplicate entries entered by the user within `OpenFolderAndSelectItems`.

* Explicitly declare that `ShellHelper.cs` is a module that allows Pinvoke.

* Use `FileMode.Create` for output PDB files to ensure existing files are fully overwritten/truncated.

* Show original filenames when generating PDBs to improve UX during batch processing.
2025-11-25 23:00:21 +01:00
Christoph Wille ac8503c005 .NET 10 RTM Package Update (#3609) 2025-11-11 15:36:39 +01:00
Christoph Wille 4f11813829 .NET 10 RC2 packages (#3599)
Note: transport feed had only 106 for dotnet-format and ILCompiler.Reflection.ReadyToRun.Experimental
2025-10-15 17:31:05 +02:00
Christoph Wille b4d33af238 Update packages to .NET 10 RC1 2025-09-09 16:14:00 +02:00
Peter Crabtree e1e16b64f5 dev: Strip BOM mark from text files 2025-08-28 20:56:19 -04:00
Peter Crabtree e7a64f3114 dev: Correct typo in ReportExcludedTypes (ilspycmd) 2025-08-26 06:51:20 +02:00
Christoph Wille afcdcec146 Update for .NET 10 Preview 7 packages (#3537)
* Update NUnit (was: 4.3.2) to 4.4 and MTP (was: 1.7.3) to 1.8.1 (had to add VSTestBridge explicitly to override ref complaints by compiler)
* Update to .NET 10 Preview 7 NuGet packages
* Update dotnet-format
2025-08-13 11:02:45 +02:00
Daniel Grunwald 90cd265e89 Update System.Reflection.Metadata dependency to 9.0.0.
Add explicit System.Security.Cryptography.Pkcs dependency to avoid security vulnerability warning in ILSpyCmd.
Suppress security vulnerability warnings in test projects.
2025-08-01 09:29:35 +02:00
Christoph Wille dad304d230 Update to .NET 10 Preview 6 NuGets (#3514) 2025-07-15 20:09:38 +02:00
Christoph Wille 36d2135ecf .NET 10.0 Preview5 NuGet Updates (#3511)
Bump all Microsoft.* and System.* to 10.0.0-preview5
Microsoft.CodeAnalysis.* to 4.14.0
Update other dependencies to latest
2025-07-09 13:40:43 +02:00
Christoph Wille c561b197a4 Add Docker containers for ILSpyCmd (interactive & automation scenarios) 2025-07-07 14:45:55 +02:00
Siegfried Pammer bf5249be2b Add --ilspy-settingsfile and -ds|--decompiler-setting name=value options 2025-07-06 17:57:15 +02:00
Andrew Au 9beb9cbdcb Upgrade packages 2025-07-04 21:27:55 +02:00
Siegfried Pammer a85ac055b5 Disable package pruning by force 2025-07-04 19:08:07 +02:00
Siegfried Pammer e4ebe20602 Upgrade dotnet target framework to net10 2025-07-04 19:08:07 +02:00
Christoph Wille 3ed6da38df NuGet updates 04/25 (#3459) 2025-04-13 09:49:49 +02:00
Christoph Wille dee50f4be0 NuGet updates for January 25 Patch Tuesday (#3369) 2025-01-14 20:31:12 +01:00
Christoph Wille 1048cd9557 Enable repeatable package restores (#3359)
Locking restricted to projects that create NuGet packages
    ICSharpCode.Decompiler
    ICSharpCode.ILSpyX
    ILSpyCmd
    ICSharpCode.BamlDecompiler
2025-01-03 14:30:08 +01:00
Holger Schmidt 09ed31d391 Generate Mermaid HTML diagrammer from input assembly via ilspycmd (#3324)
* added mermaid class diagrammer

contributed from https://github.com/h0lg/netAmermaid - find earlier git history there

* reading from embedded resource instead of file

* swapped out icon to brand diagrammers as an ILSpy product

reusing linked ..\ILSpy\Images\ILSpy.ico from UI project

* added required ilspycmd options and routed call

* adjusted VS Code task to generate model.json required by the JS/CSS/HTML dev loop

* added debug launchSettings

* updated help command output

* using ILSpyX build info in generated diagrammers
removing unused code

* using explicit type where it's not obvious

* outputting in to a folder next to and named after the input assembly + " diagrammer" by default

* renamed diagrammer output to index.html

to support default web server configs in the wild

* improved instructions for creating an off-line diagrammer

* added developer-facing doco for how to edit the HTML/JS/CSS parts

* renamed to remove netAmermaid branding

* updated repo URL and doco link to new Wiki page

* copied over doco

* removed obsolete parts

* moved CLI doco into ILSpyCmd README

* removed end-user facing chapters that go into the Wiki from dev-facing doco

* updated to ilspycmd API and rebranded to ILSpy

* removed doco that's now in https://github.com/icsharpcode/ILSpy/wiki/Diagramming

* added tasks
2024-11-15 07:56:50 +01:00
Siegfried Pammer 4ff0c262f9 Provide commit hash in AboutPage to make finding the correct version easier. 2024-09-20 22:44:32 +02:00
Christoph Wille dd7d7b806f Update command line options documentation to latest released version 2024-06-08 09:05:27 +02:00
Siegfried Pammer 963ff7cb3d Fix #3151: Make IProjectFileWriter API public 2024-03-31 18:46:46 +02:00
Christoph Wille 084d02a447 Apply Central package management (requires package source mapping) (#3124)
* Apply Central package management https://learn.microsoft.com/en-us/nuget/consume-packages/central-package-management (requires package source mapping https://learn.microsoft.com/en-us/nuget/consume-packages/package-source-mapping)

* Microsoft.DiaSymReader.Converter.Xml from dotnet-tools, Microsoft.DiaSymReader.Native from nuget.org feed

* Trying to sort what is on which feed for previews of Diasymreader packages

* Parse the Roslyn version from Directory.packages.props

* Use specific versions for Diasymreader from nuget.org to allow VS2022 addin to restore properly

* Tests needs also locked references
2023-11-23 07:25:23 +01:00
Christoph Wille abce1a5ae9 Go to latest version where applicable (ics.d stays on v6 for SRM) (#3120) 2023-11-20 12:42:30 +01:00