The MSIL Assembler generates a portable executable (PE) file from Microsoft intermediate language (MSIL). You can run the resulting executable, which contains MSIL and the required metadata, to determine whether the MSIL performs as expected.
Questions tagged [ilasm]
76 questions
17
votes
3 answers
Why does this very simple C# method produce such illogical CIL code?
I've been digging into IL recently, and I noticed some odd behavior of the C# compiler. The following method is a very simple and verifiable application, it will immediately exit with exit code 1:
static int Main(string[] args)
{
return…

lpmitchell
- 181
- 6
17
votes
3 answers
Do I understand this MSIL code correctly?
I have the following code in C#
// test.Program
private static void Main()
{
int x = 5;
int y = 100;
Console.WriteLine(y + ", " + x);
}
And I'm reading the IL code, I've never programmed assembly before so I'm asking if what I each line…

NomenNescio
- 2,899
- 8
- 44
- 82
16
votes
3 answers
.net-core: Equivalent of ILDASM / ILASM
Is there the equivalent of ILDASM / ILASM for the .net-core?
Specifically, I'm looking for something that runs on Linux (Hence why the .net-core).

Doug
- 6,446
- 9
- 74
- 107
11
votes
2 answers
Guaranteed way to find the filepath of the ildasm.exe and ilasm.exe files regardless of .NET version/environment?
Is there a way to programmatically get the FileInfo/Path of the ildasm.exe/ilasm.exe executables? I'm attempting to decompile and recompile a dll/exe file appropriately after making some alterations to it (I'm guessing PostSharp does something…

myermian
- 31,823
- 24
- 123
- 215
9
votes
2 answers
Strongly naming 3rd party 2.0 .dll with VS 2010 Ilasm.exe
So, I have a 3rd party .dll written in C# 2.0 that needs to be strongly typed and I do not have access to the source code. I found several articles on how to disassembly the .dll and re-assembly it with a strongly named key file.
Problem I am…

Sean
- 2,496
- 7
- 32
- 60
9
votes
2 answers
ILDASM and ILASM, how use them?
I'm having a hard time trying to (Dis)assemble a dll using the Visual Studio command prompt, don't look that simple as I see in the microsoft page.
I'm using the ildasm for these way:
ildasm myLibrary.dll output:MyLibrary.il
And I get: Unable to…

Freddx L.
- 455
- 2
- 7
- 16
8
votes
1 answer
ILASM does not set FileVersion
I have an .il file which I can compile without any problems. I can strong name it and so without any issues. But I am not able to set the file version via the attribute as I would expect it. How can I set the FileVersion for an assembly when using…

Alois Kraus
- 13,229
- 1
- 38
- 64
7
votes
2 answers
Are there any examples of compiling CIL code from within a Visual Studio project
I realize that it's been asked and answered that Visual Studio does not support CIL/MSIL projects. The MSBuildContrib project has an ILASM task which allows you to compile IL files at build time.
Googled came up empty on examples for how to use this…

Mark
- 9,320
- 6
- 57
- 70
6
votes
2 answers
How might I strongly sign an external DLL while retaining its assembly metadata?
I have a few libraries I use in my project that are unsigned. Because my application is strongly signed, the libraries must be as well.
I sign these libraries using:
"%PROGRAMFILES%\Microsoft SDKs\Windows\v7.1\Bin\ildasm.exe" /nobar /all…

Sandor Drieënhuizen
- 6,310
- 5
- 37
- 80
6
votes
1 answer
MSIL Methods not requiring ret
I have recently been playing around with writing MSIL and compiling it with ilasm, when I noticed that methods do require a ret instruction to return from the end of the method;
For example I should be supposed to write code like this:
.method…

Nick
- 98
- 1
- 4
5
votes
2 answers
ILASM problem when dealing with double NaN and Inf
I create a simple program with a double type value initialized,
var a = double.NaN;
I build the project with Visual Studio 2019, .net framework 4.5
and disassemble it into a .il file using ILDASM.exe Version 4.0.30319.0
IL_0001: ldc.r8 …

Hongbii Khaw
- 91
- 5
5
votes
0 answers
Is there a workaround for the bug in ilasm.exe with more than 1024 resource files?
I am referring to a bug which is known to Microsoft but ignored. See here for more information. It occurs when there are more than 1024 embedded resources in an assembly. This look like this:
This problem arises when I use the Dotfuscator to…

Yggdrasil
- 1,377
- 2
- 13
- 27
5
votes
1 answer
CIL - How do I use a public static literal field?
This might be a dumb question but I'm really curious if I can do this. I wrote the following sample program:
class Test1 {
public const int b = 8;
public static int z = 3;
public static void Main(string[] args){
const int q =…
5
votes
2 answers
How to declare a value type in CIL: `.class value` or just `.class`?
I have taken a look at a C# struct FooStruct in ILDASM, and have seen the following:
ILDASM here displays two differing declarations:
one starting with .class value public (rear window & front window's title bar)
one starting with just .class…

stakx - no longer contributing
- 83,039
- 20
- 168
- 268
4
votes
1 answer
ildasm, then ilasm with same meta data
We need to patch an assembly and we can't rebuild from source code at the moment. I can dump the IL using ildasm mydll.dll /all /out=mydll.il and then I can rebuild it with ilasm /dll mydll.il and it's all good except that things like file version,…

ILovePaperTowels
- 1,445
- 2
- 17
- 30