如何将.NET应用程序编译为本机代码? [英] How to compile a .NET application to native code?

查看:260
本文介绍了如何将.NET应用程序编译为本机代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我想在没有.NET框架的计算机上运行.NET应用程序,有没有办法将应用程序编译为本机代码?

If I want to run a .NET application in a machine where the .NET framework is not available; Is there any way to compile the application to native code?

推荐答案

Microsoft有一篇文章介绍如何将MSIL编译为本机代码

Microsoft has an article describing how you can Compile MSIL to Native Code

您可以使用 Ngen


本机映像生成器(Ngen.exe)
是一个改进托管应用程序的
性能的工具。
Ngen.exe创建本机映像,其中
是包含已编译的
特定于处理器的机器码的文件,
将它们安装到本地映像
本地计算机上的缓存。
运行时可以使用来自
缓存的本地映像,而是使用即时
(JIT)编译器来编译原始的
汇编。

The Native Image Generator (Ngen.exe) is a tool that improves the performance of managed applications. Ngen.exe creates native images, which are files containing compiled processor-specific machine code, and installs them into the native image cache on the local computer. The runtime can use native images from the cache instead using the just-in-time (JIT) compiler to compile the original assembly.

不幸的是,你仍然需要框架中的库来运行你的程序。没有我知道的MS .Net框架SDK的功能,允许你将所有需要的文件编译成单个可执行文件

Unfortunately, you still need the libraries from the framework in order to run your program. There's no feature that I know of with the MS .Net framework SDK that allows you to compile all the required files into a single executable

这篇关于如何将.NET应用程序编译为本机代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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