WPF project export misses the transitive references the XAML markup compiler needs
An exported WPF project lists only the assemblies the decompiled module references directly. The XAML markup compiler needs more than that: to resolve a type named in XAML it also needs the assemblies those direct references pull in, so a real application does not rebuild.
Repro
- Build
DevExpress.StockMarketTrader.Wpf(the demo source DevExpress publishes; the components it builds against are on nuget.org). - Open the resulting executable in ILSpy and export it as a project (or
ilspycmd -p). - Build the exported project.
The build fails with eleven errors, none of them about the decompiled C# or the regenerated XAML:
MC1000 Could not find assembly DevExpress.Printing.v26.1.Core
MC3050 Cannot find the type ...Cause
ProjectFileWriterSdkStyle.GetReferences (and the non-SDK writer) enumerates
module.AssemblyReferences, which is the direct reference list from the metadata.
That is enough for the C# compiler, which only needs what the IL actually touches,
but the markup compiler resolves XAML type names through the full closure of the
reference graph.
Notes
Found while verifying #2253 against a real application; it is in none of that issue's claims, and #4108 does not address it. It is the reason "the exported project builds" is not yet true for a real WPF application, even with the BAML fidelity fixes in place.
Prepared by an AI agent (Claude, claude-opus-5, via Claude Code).
Source: icsharpcode/ILSpy