vb.net – How to Obfuscate a .NET 8 VB Forms App as a Single File When Only the DLL is Recognized as .NET?


The Issue

  • When I build my VB Forms application in Visual Studio (targeting .NET 8), it generates both an .exe and a .dll.
  • The obfuscation tool I’m using (such as ConfuserEx or ArmDot) does not recognize the .exe as a valid .NET assembly and throws an error indicating that it “doesn’t appear to be a .NET assembly.”
  • The .dll generated alongside the .exe is recognized as a .NET assembly, and I can successfully obfuscate it.

What I Want to Achieve

I would like to deploy the application as a single, obfuscated .exe file without any external DLLs.

What I’ve Tried

  1. Single-file publish:

    • I tried using the Publish feature in Visual Studio to produce a single file by going to Project Properties > Publish > Publish Options and selecting the “Produce single file” option.
    • However, this creates a single .exe file, but since the obfuscation tool doesn’t recognize it as a .NET assembly, I can’t obfuscate the final published output.
  2. Replacing DLL with Obfuscated Version:

    • I also attempted to obfuscate just the DLL (since the obfuscator recognizes it as a .NET assembly) and then replace it in the output directory before publishing.
    • Unfortunately, this approach doesn’t work because the publishing process rebuilds everything, effectively overwriting my obfuscated DLL with the original one.

My Question

Is there a way to:

  1. Obfuscate a .NET 8 Windows Forms application so that it can still be published as a single .exe file?
  2. Ensure that the obfuscation tool recognizes and obfuscates the .exe or allows me to embed the obfuscated DLL into the final single-file executable?

Alternatively, if there’s another approach to obfuscating a .NET 8 VB application that can achieve a single-file output, I would be open to trying that.

Leave a Reply

Your email address will not be published. Required fields are marked *