Zai
Zai

Reputation: 53

C# Compilation without visual studio

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

Upvotes: 5

Views: 4320

Answers (6)

DW.
DW.

Reputation: 464

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.

Upvotes: 0

JB King
JB King

Reputation: 11910

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

Upvotes: 0

jussij
jussij

Reputation: 10560

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.

Upvotes: 3

Larsenal
Larsenal

Reputation: 51156

The command line compiler is csc.exe.

MSDN has an article that might help get you started.

Upvotes: 10

marcc
marcc

Reputation: 12399

csc.exe is the compiler.

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

Upvotes: 4

Jeffrey Aylesworth
Jeffrey Aylesworth

Reputation: 8480

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

Upvotes: 1

Related Questions