![]() Using (var peFileStream = new FileStream(sourceFileName, FileMode.Open, FileAccess. The ICSharpCode.Decompiler library also has a disassembler API (which is a bit more low-level): string code ![]() The part with resolver.AddSearchDirectory(path) in that console project may be relevant, because the decompiler needs to find the referenced assemblies. The filebrowser will start and will allow you to select an assembly, that in this example will be located in the Debug folder of our project: Once you select the executable, ILSpy will start the decompilation process and will add the selected file as an item on the Tree View. See the project for slightly more advanced usage of the decompiler API. Open ILSpy, click on File in the Menu Strip and select Open. String code = decompiler.DecompileWholeModuleAsString() decompile whole assembly to a string: var decompiler = new CSharpDecompiler(assemblyFileName, new DecompilerSettings()) ![]() To decompile programmatically, use the ICSharpCode.Decompiler library (available on NuGet).Į.g. When decompiling to C#, the save dialog will have options for saving a C# project (.csproj) with separate source code files per class or a single C# file (.cs) for the whole assembly. ILSpy will use the currently selected language to do so, so it can both disassemble and decompile. With ILSpy, you can select an assembly node in the tree view, and then use File > Save Code to save the result to disk.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |