问题
I am using ILSpy, a free .NET assembly decompiler, to analyze the standard and 3rd party .NET assemblies. It works enough well for the standard .NET WinForms and WPF libraries, but I could not decompile System.Windows.dll for Windows Phone 8 located in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\WindowsPhone\v8.0\
. It displays the members, but their internals (source code) are empty.
Is it a problem of ILSpy, or we cannot decompile Windows Phone .NET libraries using any other tools like Red Gate's .NET Reflector? Is there any other way to get/view the source code of these assemblies?
回答1:
The assemblies that are installed in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\WindowsPhone\v8.0
are just placeholders used for the auto-completion in Visual Studio. You can extract the real assemblies directly by mounting the VHD image used by the emulator (the images are located in C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Emulation\Images
). I don't remember exactly where the .NET assemblies are stored in the VHD, but you should be able to find them easily by using the search feature of the Windows Explorer. Those are standard .NET assemblies, so you can open them with any decompiler (ILSpy, Reflector, JustDecompile, ...).
来源:https://stackoverflow.com/questions/22383996/cannot-decompile-system-windows-dll-for-windows-phone-8-with-ilspy