Can I run an image do.NET Native directly?

I compiled my executable in C # to a .NET Native image using ngen.exe, i have the file location, but when I go to run Windows says the executable is invalid.

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

If I can't run the image, I can decompile your code to recompile to C++ and compile in Windows32?

Author: Maniero, 2018-01-20

1 answers

O ngen and .NET Native are completely different things , What You Used can only run with the .NET Framework .

Will not achieve the goal with it, no matter what you do.

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

And it seems to me that you want to use the .NET Core . There is a possibility to try Mono. If not solve and the current limitations of .NET Native do not meet your problem, I see no solution at the moment.

 2
Author: Maniero, 2020-12-22 17:10:15