Compiling C# to Native?

后端 未结 11 1369
醉酒成梦
醉酒成梦 2020-12-12 10:26

I think I\'m somewhat confused about compiling .NET byte-code to native code, or maybe I\'m confused about the end result. So please bear with me as I try to sort through w

11条回答
  •  情歌与酒
    2020-12-12 11:11

    This is finally possible using Microsoft's .NET Native compiler

    It automatically compiles the release version of apps that are written in managed code (C# or Visual Basic) and that target the .NET Framework and Windows 10 to native code.

    ..

    •Your apps will provide the superior performance of native code.

    •You can continue to program in C# or Visual Basic.

    •You can continue to take advantage of the resources provided by the .NET Framework, including its class library, automatic memory management and garbage collection, and exception handling.

    For users of your apps, .NET Native offers these advantages:

    •Fast execution times

    •Consistently speedy startup times

    •Low deployment and update costs

    •Optimized app memory usage

    But .NET Native involves more than a compilation to native code. It transforms the way that .NET Framework apps are built and executed. In particular:

    •During precompilation, required portions of the .NET Framework are statically linked into your app. This allows the app to run with app-local libraries of the .NET Framework, and the compiler to perform global analysis to deliver performance wins. As a result, apps launch consistently faster even after .NET Framework updates.

    •The .NET Native runtime is optimized for static precompilation and thus is able to offer superior performance. At the same time, it retains the core reflection features that developers find so productive.

    •.NET Native uses the same back end as the C++ compiler, which is optimized for static precompilation scenarios.

    https://msdn.microsoft.com/en-us/library/dn584397(v=vs.110).aspx

    This is only available with VS.NET 2015.

提交回复
热议问题