As mentioned in some other answers, you can use .NET Native to compile your application into native machine code. However, unlike these answers, I will explain how to do this.
Steps:
Install the dotnet CLI tool (command line interface), which is part of the new .NET Core key binding. We will use this to compile our application; You can find a good article about it here.
Open a shell and cd prompt in your application directory.
Enter this:
dotnet compile --native
What is it! When you are done, your application will be compiled to a single binary file, for example:

This will be a standalone executable; no PDBs, assemblies or configuration files (hooray!).
Alternatively, if you want an even faster program, you can run this:
dotnet compile --native --cpp
This optimizes your program using a C ++ code generator (unlike RyuJIT), so your application is even more optimized for AOT scripts.
Further information on this can be found in the dotnet CLI GitHub repo .
James Ko Feb 17 '16 at 20:48 2016-02-17 20:48
source share