Alex
Alex

Reputation: 2609

How to use .NET Core 2.0 ilasm.exe?

I'm trying https://www.nuget.org/packages/runtime.win-x64.Microsoft.NETCore.ILAsm/ (upon Where is ilasm.exe in Microsoft.NETCore.ILAsm?) on a Win 10 Pro x64 PC. Nothing happens.

Whatever syntax I'm using, still nothing. E.g. no .dll is generated from my input and nothing is printed in the console.

Even if I just run "ilasm" (no parameters), no output is produced. It remains completely silent. At the same time, if I run older C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\ilasm.exe, it always produces some output (for instance, parameter usage reference).

How am I supposed to use this latest ilasm.exe for .NET Core 2.0? Does it have different command line arguments? Or, maybe, I need some additional files for it to work (although the package didn't have anything meaningful but ilasm.exe itself)?

Upvotes: 3

Views: 1950

Answers (1)

Martin Ullrich
Martin Ullrich

Reputation: 100581

The .NET Core variants of ILAsm and ILDasm depend on core assets of the build of the same CoreCLR version they are built for. If they are restored via a dependency graph, a self-contained .net core deployment depending on Microsoft.NETCore.ILAsm should contain all assets for the target runtime.

To get the extracted version of ilasm.exe / ildasm.exe to work without doing that, you need to copy the coreclr.dll from the matching .net core version into the same directory. This file can be found in C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.0 if a .NET Core 2.0.0 runtime is installed in its default location.

Upvotes: 2

Related Questions