tags:

views:

171

answers:

6

I am learning C# and I know the advantages and ease of using Visual Studio but basically I want to learn the mechanics of C# the old school way. I understand that I need to the least .NET Framework and Notepad to compile C# code which I have already. Now I have created the small app as myApp.cs and I want to know how should I compile it as executable from command line cmd.exe

+1  A: 

http://www.devsource.com/c/a/Using-VS/Working-at-the-Visual-Studio-Command-Line/

That should help. It describes how to command line compile using the Visual Studio tools

Jeffrey Aylesworth
+4  A: 

csc.exe is the compiler.

http://msdn.microsoft.com/en-us/library/78f4aasd.aspx

marcc
+7  A: 

The command line compiler is csc.exe.

MSDN has an article that might help get you started.

Larsenal
What's the difference between .NET Framework and .NET Framework SDK?MSDN Article mention .NET Framework SDK and I see that I have .NET Framework all of the versions from 1.1 to 3.5 SP1 and yes the folder does contain the csc.exe
Zai
The .NET Framework is the runtime, and the SDK is the Software Development Kit for the runtime. It has extra things like disassemblers, a debugger, code-signing tools, tools for manipulating the Global Assembly Cache, and so on.
Joel Mueller
+3  A: 

It is actually very easy to run the csc.exe compiler outside of the IDE but the trick is to make sure you have first run the vsvars32.bat file. This batch file sets up all the environment variables required by the compiler.

And while you're at it you can even debug the program outside the IDE by using the standalone debugger.

jussij
Thank you. Environment setup was something which solved it.
Zai
A: 

nAnt and msbuild are a couple of other utilities that may be useful beyond just the compiler.

JB King
A: 

Good idea, I think it can help with understanding what is going on.

Using csc:

The /recurse flag is really useful and can be used to compile all files in a directory tree.

If you want to make life a little bit easier for yourself while still staying close to the basics use a nicer text editor than notepad. One that can call a batch file that compiles and runs your program. Then you can set it up so that when you click on a compile error it goes to the source code for that error.

DW