将 .NET 可执行文件转换为本机可执行文件

发布于 2024-07-29 18:16:33 字数 160 浏览 6 评论 0原文

是否有任何方法可以将 .NET 开发的应用程序转换为本机可执行文件(包括源代码)?

安装整个框架(最高可达 .NET Framework 3.5 SP1)需要花费大量时间 - 计算机并不总是从互联网上更新。 是否可以调用 NGen 来生成独立的可执行文件?

谢谢

Is there any approach to convert an application developed in .NET into a native executable (sources are included)?

Installing the whole framework (up to .NET Framework 3.5 SP1) takes a lot of time - not always the computers are updated from the internet. Is it possible to call NGen in order to produce independent executables?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(11

喵星人汪星人 2024-08-05 18:16:33

目前尚未推出,但 Mono 项目团队正在开发一个 Ahead of Time 编译器,它将做你正在寻找的事情。 Mono 的目的是在 iPhone 上工作(就像 Unity),但它应该适用于所有平台。

编辑:它确实支持 Mono x86,但我不确定他们是否已经包含了打包在依赖类中的功能(尽管从我听说的采访来看,这是计划中的)

编辑 2: 目前支持包含依赖项,感谢 Dykam!

It's not available yet, but the Mono project team are working on an Ahead of Time compiler that will do what you are looking for. The intention is for Mono to work on the iPhone (like Unity) but it should work for all platforms.

Edit: It does support Mono x86, but I'm not sure if they have included the feature that packs in dependent classes yet (though from an interview I heard, it's planned)

Edit 2: Including dependencies is currently supported, thanks Dykam!

明媚如初 2024-08-05 18:16:33

不,NGen 代码仍然需要框架 - 它仅在您自己的程序集中预 JIT 代码。 它还需要 CLR 本身的框架。

我相信 Mono 有一个静态编译器,他们计划将其用于 iPhone。 我不知道这是否也适用于 Windows。

曾经有一个名为 Thinstall 的产品,有些人用它来实现此目的。 它现在称为 ThinApp - 基本上它是应用程序虚拟化。 它是商业版,但您很可能可以获得试用版。

就我个人而言,我对任何此类产品都有些担心——在部署方面,偏离主流的做事方式听起来像是招致大量支持电话的秘诀。 出错的地方实在是太多了。 我并不是说这不起作用,只是我会保持警惕。

您是否看过 .NET 3.5 (SP1) 客户端配置文件? 这可能有助于稍微减少您的安装要求。

No, NGen'd code still needs the framework - it only pre-JITs the code in your own assemblies. It also requires the framework for the CLR itself.

I believe Mono has a static compiler which they're planning on using for the iPhone. I don't know whether that will work on Windows as well though.

There used to be a product called Thinstall which some people used for this. It's now called ThinApp - basically it's application virtualisation. It's commercial, but you may well be able to get hold of a trial version.

Personally I'd be somewhat concerned about any such product - when it comes to deployment, veering away from the mainstream way of doing things sounds like a recipe for lots of support calls. There's just an awful lot to go wrong. I'm not saying it doesn't work, just that I'd be wary.

Have you looked at the .NET 3.5 (SP1) Client Profile? That may help to reduce your installation requirements a little.

君勿笑 2024-08-05 18:16:33

使用 .net 3.5 SP1,可以安装 .net 框架的较小子集。 看看这个截图:
Visual Studio项目属性
(来源:windowsclient.net

With .net 3.5 SP1 it is possible to install a smaller subset of the .net framework. Take a look at this screenshot:
Visual Studio Project properties
(source: windowsclient.net)

残龙傲雪 2024-08-05 18:16:33

您可以使用 NGen 使您的应用程序成为本机可执行文件,但它仍然依赖于 .Net 框架。

You can use NGen to make your application a native executable, but it will still be dependent upon the .Net framework.

趁年轻赶紧闹 2024-08-05 18:16:33

NGen 将exes编译为本机exes,因此它们在运行时不需要进行JIT编译。 但它们仍然依赖于框架。

有一些商业公司确实提供将 .net 程序集编译成独立 exe 的产品。 Xenocode 和 vmware 的 Thinapp. 不过,两者都不便宜。

NGen compiles the exes to native exes, so they do not need to be JIT compiled as they are run. They are still dependant on the framework though.

There are a few commercial companies that do provide products for compiling .net assemblies into standalone exes. Xenocode and vmware's Thinapp. Neither are cheap though.

多像笑话 2024-08-05 18:16:33

有些混淆器会这样做,但您必须事先这样做(在将其发送给用户之前)。 一个例子是 remotesoft 的 Salamander

Some Obfuscators do this, you would have to do it beforehand though (before you ship it to your users). An example is remotesoft's Salamander.

娇女薄笑 2024-08-05 18:16:33

您只需要安装您要定位的 .NET 版本,例如 .NET1.1 .NET2.0

编辑:如果您需要定位 3.5 版本,则需要安装 2.0 和 3.5

ILMerge(免费)可以将多个程序集合并为一个程序集,但我认为它不适用于核心运行时。

简而言之,我认为如果您想运行 .NET 程序,您将需要安装 .NET Framework。

You will only need to install the version of .NET that you are targeting e.g. .NET1.1 or .NET2.0

Edit: If you need to target the 3.5 version you will need to install both 2.0 and 3.5

ILMerge (Free) can combine several assemblies into one, but I don't think that it works with the core runtimes.

In short I think that if you want to run .NET programs you will need the .NET Framework installed.

安静 2024-08-05 18:16:33

有一个商业产品声称可以这样做:

http://www.xenocode.com/Obfuscator/< /a>

“安全部署 .NET 应用程序,无需安装 .NET Framework”

不知道这样做有什么缺点

There is a commercial product that claims to do that here:

http://www.xenocode.com/Obfuscator/

"Deploy .NET applications securely, with no .NET Framework install"

No idea what the drawbacks to this would be though

瀟灑尐姊 2024-08-05 18:16:33

来自 vmware 的 ThinApp(以前称为 Thinstall)。 不过以前很贵。

http://www.vmware.com/products/thinapp/

ThinApp (formerly Thinstall) from vmware. Used to be very expensive, though.

http://www.vmware.com/products/thinapp/

可爱咩 2024-08-05 18:16:33

我们在 2007 年创建的唯一解决该问题的产品是 Xenocode Postbuild。 从那时起我们成功使用了这个产品,我们也使用了它相当好的虚拟化功能。

唯一的问题是我们购买的版本不支持Windows 7(您不需要安装.net框架来运行使用<4.0版本编译的程序)。 所以我写信给Xenocode。 他们回答说

为了获得对 Win 7 的支持,您应该升级到最新版本的 Postbuild(现在称为.NET Obfuscator)。 Win 7 不是 Postbuild 2007 支持的平台。

The only product we founded to solve the problem in 2007 was Xenocode Postbuild. From that time we use this product successfully, we use also its pretty good virtualization features.

The only problem is that the version we purchased don't support the Windows 7 (where you don't need to install .net framework to run your program compiled with version < 4.0). So I wrote to Xenocode. They answered

In order to get support for Win 7 you should upgrade to the newest version of Postbuild (now called .NET Obfuscator). Win 7 is not a supported platform for Postbuild 2007.

夜巴黎 2024-08-05 18:16:33

为什么不是 Ngen.exe? http://msdn.microsoft.com/en- us/library/6t9t5wcf(v=vs.80).aspx

它将 .Net 程序 转换为 Native 程序,如果您有.Net框架

Why not Ngen.exe? http://msdn.microsoft.com/en-us/library/6t9t5wcf(v=vs.80).aspx

It converts .Net Programs into Native Programs also and you already have it if you have the .Net Framework

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