Can I run a .NET Native image directly?


I have compiled my executable in C # for a .NET Native image using ngen.exe , I have the location of the file, but when I run Windows it says that the executable is invalid.

My goal was to make my application written in C # independent of the .NET Framework and / or store .NET in a DLL next to the output executable. The input executable is a simple "Hello World" with no dependency.

If you can not run the image, can I decompile your code to recompile to C ++ and compile under Windows32?

asked by anonymous 20.01.2018 / 21:10

1 answer


ngen and .NET Native are completely different things , which you used can only run with the .NET Framework.

You will not reach the goal with it, no matter what you do.

Thinking that Windows32 is talking about the Win32 API, if it does in .NET, it does not access it directly. Native code has nothing to do with the API that accesses.

And I think you want to use .NET Core . There is a possibility of trying the Mono. If it does not resolve and the current .NET Native limitations do not address your issue, I do not see a solution right now.

20.01.2018 / 23:05