我在 Wikipedia 上阅读了以下关于 CLR 的文章:
Alternatively, the CIL code can be compiled to native code in a separate step prior to runtime by using the Native Image Generator (NGEN). This speeds up all later runs of the software as the CIL-to-native compilation is no longer necessary.
这是否意味着我可以获取任何 .NET 程序并将其编译为二进制文件,然后该二进制文件将能够在未安装 .NET 框架的机器上运行?
最佳答案
没有。
这意味着您在运行代码时不需要运行 JIT (Just-In-Time) 编译器,因为 NGen 已经将其转换为机器码。生成的二进制文件仍然依赖于 .Net 框架,并且必须在机器上单独安装。
有些工具可以打包 .Net 框架程序集并将它们以不需要 .Net 框架的方式包含在您的二进制文件中。查看 http://www.xenocode.com/ . VMWare 买了一个叫 Thinstall 的工具,我认为它也可以做到这一点:http://www.vmware.com/products/thinapp/ .
关于.net - ngen 是否用于将 .NET 代码编译成在运行代码时不需要安装 .NET 框架的二进制文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3173116/