Question

Can anyone please help in this problem?

============

When we decompile code from assembly (example):

        AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly(fileName);
        AstBuilder decompiler = new AstBuilder(new DecompilerContext(assembly.MainModule));
        decompiler.AddAssembly(assembly);
        StringWriter output = new StringWriter();
        decompiler.GenerateCode(new PlainTextOutput(output));

we get code in the format where all the "using" statements are at top of file and the classes are placed appropriately.

This is problem for me. I need to know the full namespace path to a class/struct/enum etc. after decompilation. So, instead of having all the namespaces in "using" block, is there an option to write full class path for each object?

Example of desired output:

class TestApp {
    public class System { }
    const int Console = 7;
    const int number = 66;
    static void Main() {
        global::System.Console.WriteLine(number);
    }
}

============

Link to my post on ILSpy forum

http://community.sharpdevelop.net/forums/t/19302.aspx

Was it helpful?

Solution

ILSpy community acknowledged that as of today, this feature is not present.

Current Version means - ILSpy 2.0 (ILSpy_Master_2.1.0.1603_RTW_Binaries.zip)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top