捆绑 .NET dll 以在无 .NET 的计算机中运行应用程序?
AFAIK, ngen 将 MSIL 转换为本机代码(也称为 pre-JIT),但是我从未过多关注它对启动性能的影响。 Ngen 应用程序仍然需要 .NET 基类库(运行时)。
由于基类库拥有我们的 .NET 程序集所需的一切(正确吗?),是否可以将框架的 DLL 与我的 ngen 应用程序一起提供,以便不需要安装运行时? (例如,大多数 Windows XP 计算机的情况)
哦,请不要提及 Remotesoft 的 Salamander Linker 或 Xenocode 的 Postbuild。它们不适合我(和许多人)当前的预算(它们似乎只是将框架捆绑在虚拟化环境中,这意味着我相信下载量大且启动时间慢)
编辑:
我现在知道,ngen 并没有做我想象的那样。
但是是否可以在不使用虚拟机的情况下将 .NET 文件与应用程序捆绑在一起?
AFAIK, ngen turns MSIL into native code (also reffered to as pre-JIT), however I never payed too much attention at it's startup performance impact. Ngen'd applications still require the .NET base class libraries (the runtime).
Since the base class libraries have everything our .NET assemblies need (correct?) would it be possible to ship the framework's DLLs with my ngen'd application so that it does not require the runtime to be installed? (e.g., the scenario for most Windows XP machines)
Oh, and please don't bother mentioning Remotesoft's Salamander Linker or Xenocode's Postbuild. They are not for my (and many's) current budget (and they seem to simply bundle the framework in a virtualized enviroinment, which means big download sizes and slow startup times I believe)
EDIT:
I know now, ngen doesn't do what I thought it did.
But is it possible to bundle the .NET files with an application, without using a VM?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
你不能这样做。许多基本组件(例如垃圾收集器)都是 CLR(它是框架运行时的一部分)的一部分,因此为了成功执行您的应用程序,您需要安装框架。
You cannot do this. Many essential components such as the garbage collector are part of the CLR (which is part of the framework runtime), so in order to successfully execute your application you need the framework installed.
看一下 Microsoft .NET Native:
它将是集成在 Visual Studio 2014 中。
Have a look at Microsoft .NET Native:
It will be integrated in Visual Studio 2014.
Ngen 不是这样工作的。它仅绕过 JIT 编译步骤。生成的 .ni.dll 文件仅包含机器代码,而不包含程序集的元数据。为此,您需要保留原始程序集。并且 CLR 和 .NET 框架程序集必须在目标计算机上可用,这要求您安装 .NET。
That's not how Ngen works. It only bypasses the JIT compilation step. The resulting .ni.dll file only contains machine code, not the metadata of the assembly. You need to keep the original assembly available for that. And the CLR and the .NET framework assemblies must be available on the target machine, requiring you to install .NET.
请参阅如何编译 .NET 应用程序到本机代码? - 共识似乎是不可能的。
See How to compile a .NET application to native code? - the consensus looks to be that it's not possible.