简体   繁体   English

将.NET汇编编译成x86机器码

[英]Compile .NET assembly into x86 machine code

Is there any way to compile a .NET assembly into native code (ie for x86) output, that is, without MSIL.有没有办法将 .NET 程序集编译为本机代码(即 x86)output,即没有 MSIL。

For what I understand if you just specify x86 as architecture this would only change the PE Header to point that out to the JIT, but still the assembly will contain MSIL and will be JITTed as needed.据我了解,如果您仅将 x86 指定为架构,这只会更改 PE Header 以将其指向 JIT,但程序集仍将包含 MSIL 并将根据需要进行 JIT 化。

NGen does produce assembly files for the specified architecture but it's not a compiler, it's designed to improve performance but you do still need the original DLL, the presence of the native image only serves to avoid JIT compiling the assembly but you just can't get that native image and use it, can you? NGen 确实为指定架构生成程序集文件,但它不是编译器,它旨在提高性能,但您仍然需要原始 DLL,本机映像的存在仅用于避免 JIT 编译程序集,但您无法获得那个原生图像并使用它,可以吗?

So, is there any way to actually compile from .NET to native machine code?那么,有什么方法可以从 .NET 实际编译为本机代码?

Spoon Studio (was named Xenocode before) seems to be able to do that: http://spoon.net/Studio/Features.aspx Spoon Studio(之前被命名为 Xenocode)似乎能够做到这一点: http://spoon.net/Studio/Features.aspx

RemoteSoft also have a product but the website looks quite old: http://www.remotesoft.com/linker/ RemoteSoft 也有一个产品,但网站看起来很旧: http://www.remotesoft.com/linker/

You can do this using the new precompilation technology called .NET Native.您可以使用称为 .NET Native 的新预编译技术来执行此操作。 Check it out here: http://msdn.microsoft.com/en-US/vstudio/dotnetnative在这里查看: http://msdn.microsoft.com/en-US/vstudio/dotnetnative

Currently it is only available for Windows Store Apps.目前它仅适用于 Windows 商店应用程序。 It performs single component linking.它执行单个组件链接。 So .NET Framework libraries are statically linked into your app.因此 .NET 框架库静态链接到您的应用程序中。 Everything is compiled to native and IL assemblies are no longer deployed.一切都编译为本机,不再部署 IL 程序集。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM