Hi there, I am having some trouble compiling what I believe to be unmanaged code (output from monodis) back into C# for analysis.
What is the correct procedure or program to use for this?

Thanks.

PS. I don’t know whether it would help at all, but the output begins like this:

.assembly extern mscorlib
{
  .ver 2:0:0:0
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
}
.assembly extern System.Windows.Forms
{
  .ver 2:0:0:0
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
}
.assembly extern System
{
  .ver 2:0:0:0
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
}
.assembly extern System.Drawing
{
  .ver 2:0:0:0
  .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....:
}
.assembly 'HelloWorld'
{
  .custom instance void class [mscorlib]System.Runtime.InteropServices.ComVisibleAttribute::'.ctor'(bool) =  (01 00 00 00 00 ) // .....

That looks like the code from an IL disassembler such as ILDADM (comes with Visual Studio), it would be in the program's manifest. What you're looking at are using statements. It translates to

using System;
using System.Windows.Forms;
using System.Drawing;

If you'd like, you can do a google search on converting IL to C# code.

Ahh so it does make sense!
I have tried using ILASM to recompile it, but I kept getting an error message.

Can you recommend a specific program that you would think works?

Not a clue. Although that appears to be little more than the standard "hello world" program. If I had to bet, I'd wager it's little more than a small winform program that does nothing more than display the phrase "Hello world!" to the user, either through a message box or printed to a label on a form. If you have the rest of the IL, you can most likely figure out what's happening. If you need help writing a Hello World program, there are plenty of samples on the internet.

Edit: how about .NET Reflector

http://www.red-gate.com/products/reflector/

Edited 6 Years Ago by apegram: n/a

Yes, you're right - it isn't actually a 'Hello World' program.
I do have the rest of the IL, and I understand what it does, but my aim is to compile what I have into a more-usable form for use Visual Studio or a similar program.
I shall keep searching for other ways to do this - hopefully someone else might have a suggestion or two.

Thanks

This article has been dead for over six months. Start a new discussion instead.