0

I have visited this and found no answer How to convert a .NET exe to native Win32 exe? for me. I am searching for a program that converts .net exe to win32 exe. Is that possible ? I have run ngen.exe from Microsoft, but when I write the command that should convert the assembly, it tells that converting successed, but I don't find the converted exe: This is the command:

start ngen install C:\program.exe /debug
Community
  • 1
  • 1
  • 2
    Why would you want this? Can you not just install the .Net Framework and save yourself from a painful hassle that is bound to result in a buggy application? – Bazzz Apr 16 '11 at 16:44
  • possible duplicate of [How to convert a .NET exe to native Win32 exe?](http://stackoverflow.com/questions/846978/how-to-convert-a-net-exe-to-native-win32-exe) – Sebastian Paaske Tørholm Apr 16 '11 at 16:45
  • @Bazzz I know that is hard, but some users don't have .net framework to run .net applications. I see many many programs run on every windows machine. How did they do it? –  Apr 16 '11 at 16:46
  • 3
    They wrote it in something that doesn't compile to .net byte code like C++. – stonemetal Apr 16 '11 at 17:12

2 Answers2

5

You need a much bigger weapon to create a native win32 executable from a managed program. Ngen.exe merely pre-compiles the IL, the CLR and the original assemblies are still needed to run the program.

The kind of tool you need was somewhat popular in the early days of .NET when programmers were fretting about getting the .NET framework installed on the target machine. They are known as ".NET linkers", Salamander was popular. No idea if it has kept up with .NET versions, you definitely want to verify the trial version first. Also beware of the considerable sticker-shock you'll suffer.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • Here is a [changelog](http://www.remotesoft.com/linker/change_logs.html) of the Salamander. Doesn't seem to support modern .NET versions. – Paya Apr 16 '11 at 17:32
1

I think ngen.exe installs the native image in the cache. So you don't really see it as a file on disk, but it will run when you invoke the application.

You can see what images are in the cache with

ngen display
Larry Watanabe
  • 10,126
  • 9
  • 43
  • 46
  • How to find that "cache" ? I want to share the converted exe –  Apr 16 '11 at 16:48
  • 1
    @Mr. DDD - I don't know if the cache even exists on disk - it might be kept in memory -- I don't think that's supposed to be exposed to the user. – Larry Watanabe Apr 16 '11 at 17:04
  • 1
    @LarryWatanabe It is on disk, but it doesn't matter - it's not a complete PE EXE, you can't directly run it. Ngen just does some precompilation to improve application load-times, it doesn't convert the .NET exe to a "native" exe. You still need the CLR, the VM, GC, ... – Luaan Feb 11 '14 at 12:37