My Blog

Editing .NET assemblies

The other day I was asked if I could remove an image from a .NET application. Since I didn’t have the source code for that application I had to do something else than to simply remove the image and recompile the application. Anyway, it turned out to be fairly simple anyway. The following describes the steps I had to go through (note that this will not work if the application was signed by the author).

Disassemble the .NET application

Use the ildasm tool to disassemble the application:

ildasm /output=fooapp.il fooapp.exe

This will output a lot of stuff but right but this time only the .resource files were of interest.

Edit the resource file(s)

Use a resource editor to remove or change the image - I used the excellent .NET Resourcer from Lutz Roeder (http://www.aisto.com/roeder/dotnet/). Open and edit the resource containing the image.

Reassemble the application

Use the ilasm to reassemble the application (NB: this will overwrite the original application):

ilasm /resource=fooapp.il /output=fooapp.exe fooapp.il

And thats basically it.