Can someone give me an example of how I can create an exe file with no dependencies from a console app project?
I know that in bin/debug I will have the exe file after compiling my code. I would like to know how can i make an exe that will run on every computer without the need to install Visual Studio (or any other dependency: eg .net framework) on that particular computer. Is it possible?
Is there a better way to create .exe files that run on every computer?
The user doesn’t have to install Visual Studio in order to use an app built in C#. They do have to have the .NET framework installed, however.
Modern versions of Windows have come with .NET preinstalled for a while, and they’ve been part of Windows update, too – obviously the earlier the version of .NET you target, the more computers you’re likely to be able to run on. I expect that targeting .NET 2.0 should give pretty good coverage, although that way you miss the goodies from LINQ etc.
While there are “native” compilers for .NET, I don’t know of any mainstream ones… the Mono AOT is probably the closest to mainstream, but I haven’t used it myself.