Typically for regular apps this is done with ngen at installation time. It takes your .net assembly and does AOT (ahead of time) compilation to native code. It applies CPU specific optimizations, so generated native code is not really distributable. Here's more information on ngen:
https://msdn.microsoft.com/en-us/library/6t9t5wcf.aspx
If you use .NET Core runtime then it should be possible to use
crossgen tool to compile native code. Not sure how well it is supported though. I believe officially they support AOT compilation only with
CoreRT which is alternative .NET Core runtime. Here's the guide how to use it:
https://github.com/dotnet/corert/blob/master/Documentation/README.md
And if you write Windows Store applications then you can use
.NET Native (which comes with Visual Studio) to do AOT.