Q: Hey, I just started trying to learn C # this week, and I was wondering if anyone knew a way to compile C # program in a way that in a computer without. NET Framework installed. I have this client-server program that my friends and I use it as an instant messaging / file transfer program for fun, but we want to beable to use it on any computer reguardless if it is installed. Net or not. would be Visual Basic or Visual C + + allow me to do this?
guy
Best Answer: Yes there is a way. Use your friend's or colleges's computer on which .net framework is already installed. ! Cheers
Re:yea, i was researching ngen.exe and it won't help, i guess i'll just have to do it all in c++ or c, which will be good practice for me over the break. i orginally did it in java because they have good solutions for managing threads, but since i'm not having to keep up with any global variables in my program, it shouldn't be a issue. thanks for the help!
guy
Re:The .net compiler creates virtual machine code that needs to run on the .net virtual machine, just like the java compiler creates virtual machine code that needs to run on a java virtual machine.
AFIAK, there is no compiler for either that that will compile your program directly into machine code, so it will run without the virtual machine.
Re:yeah, c# programs have to use the common language runtime, so you can't run them without .net. i would also recommend the c++ compiler that comes with visual studio (visual c++). g++ is also okay, but if you already have visual studio, having the use of the IDE is nice.
edit: guy mentioned ngen.exe and that does create a native executable, but all that does is avoid the just-in-time compilation that normally happens when you run a .net executable. the resulting "native executable" is still considered "managed" and still needs the CLR.
Re:You can download Visual C++, I think they call it the express edition or something like that, from MS for free. That's pretty much the standard C++ compiler for windows.
Re:well, the whole reason i did it in c# was because its really easy to make socket programs, so is java for that matter. so if i have to write it in c or c++, whats a good compiler for windows, i've only used g++ in linux and really don't know where to begin.
Re:Sorry, I think you will have to rewrite that in C or C++. The syntax is similar, but the networking functions are different… shouldn't be too hard.
Re:Sorry, I'm pretty sure that's impossible. The .NET framework is a virtual machine. *Maybe* native image generator (ngen.exe) will do it, but I don't know if that means make it in to a native EXE.
0 Comments.