开发者

C# Compilation without visual studio

开发者 https://www.devze.com 2022-12-14 19:57 出处:网络
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 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 Fr开发者_C百科amework 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


The command line compiler is csc.exe.

MSDN has an article that might help get you started.


csc.exe is the compiler.

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


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.


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


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消