DnSpy fails to decompile self-contained single file produced C# .exe

1k Views Asked by At

I have created a simple project written in C# using Visual Studio 2022 (.NET Core 6.0) and have published my project to a folder in a single file, self contained form in order for the produced .exe to contain both the dll and the json files of the project.

While decompiling the produced .exe locally (in my computer) with DnSpy, I can nicely see the classes of the program, I can debug it, modify it etc.

The problem comes in the case when I try to load it to DnSpy in some other computer, or a vm for example. Loading it to DnSpy only shows the PE headers section, not the classes or any other information that I would expect to see. The .exe runs fine, but it just fails to decompile in DnSpy.

This has confused me a bit because I have tried to decompile other peoples projects in DnsPy in the past and they decompile just fine.

Any suggestions of how to fix this issue or why this happens in general? I mean, why can I decompile it fine in my computer (in DnSpy) but not in any other machine?

0

There are 0 best solutions below