捆绑 .NET dll 以在无 .NET 的计算机中运行应用程序?

发布于 2024-08-25 06:42:09 字数 703 浏览 5 评论 0原文

AFAIK, ngen 将 MSIL 转换为本机代码(也称为 pre-JIT),但是我从未过多关注它对启动性能的影响。 Ngen 应用程序仍然需要 .NET 基类库(运行时)。

由于基类库拥有我们的 .NET 程序集所需的一切(正确吗?),是否可以将框架的 DLL 与我的 ngen 应用程序一起提供,以便不需要安装运行时? (例如,大多数 Windows XP 计算机的情况)

哦,请不要提及 Remotesoft 的 Salamander LinkerXenocode 的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

智商已欠费 2024-09-01 06:42:09

你不能这样做。许多基本组件(例如垃圾收集器)都是 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.

梦断已成空 2024-09-01 06:42:09

看一下 Microsoft .NET Native

.NET Native 将 C# 编译为本机代码,其执行方式类似于 C++。
您将继续受益于我们的生产力和熟悉度
.NET Framework 具有本机代码的出色性能。

它将是集成在 Visual Studio 2014 中。

Have a look at Microsoft .NET Native:

.NET Native compiles C# to native machine code that performs like C++.
You will continue to benefit from the productivity and familiarity of
the .NET Framework with the great performance of native code.

It will be integrated in Visual Studio 2014.

清欢 2024-09-01 06:42:09

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.

萌辣 2024-09-01 06:42:09

请参阅如何编译 .NET 应用程序到本机代码? - 共识似乎是不可能的。

See How to compile a .NET application to native code? - the consensus looks to be that it's not possible.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文