是否有可能编译.NET IL code到机code? [英] Is it possible to compile .NET IL code to machine code?

查看:179
本文介绍了是否有可能编译.NET IL code到机code?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想没有.NET框架分发我的.NET程序。是否有可能一个.NET程序被编译成机器code?

I would like to distribute my .NET programs without the .NET framework. Is it possible to compile a .NET program to machine code?

推荐答案

是的,你可以使用Ngen.exe,但是这不会删除CLR依赖precompile。

Yes, you can precompile using Ngen.exe, however this does not remove the CLR dependence.

您还必须运送IL组件为好,NGEN的唯一好处是,你的应用程序可以启动,而不必调用JIT,所以你得到一个真正的快速启动时间。

You must still ship the IL assemblies as well, the only benefit of Ngen is that your application can start without invoking the JIT, so you get a real fast startup time.

据CLR通过C#:

此外,使用组件precompiled   NGEN通常比JIT'ed慢   组件因为JIT编译器   可以优化到目标机器   (32位?64位?特殊寄存器?   等),而NGEN只会产生   基准编制。

Also, assemblies precompiled using Ngen are usually slower than JIT'ed assemblies because the JIT compiler can optimize to the targets machine (32-bit? 64-bit? Special registers? etc), while NGEN will just produce a baseline compilation.

编辑:

有来自CLR通过C#上面的信息存在争议,因为有些人说,你必须只作为安装过程的一部分,在目标机器上运行NGEN。

There is some debate on the above info from CLR Via C#, as some say that you are required to run Ngen on the target machine only as part of the install process.

这篇关于是否有可能编译.NET IL code到机code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆