With cmd write a c # application (without visual studio)

Now, Microsoft for the majority of developers with a large IDE-visual studio, but some beginners think too much, or some people on the outside, did not bring their own computer, using other people's writing program, a visual installation studio is not overstated, there is no generic way what a computer does. .net farmerwork provides c #, c ++, java, vb , etc., provided by a .net language, we can achieve a test run, coding, etc. on the console.
The first step: to the computer with the environment
to find the location
C: \ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 (64 bit PCs)
C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 (32 bit PCs)
Right Computer -> properties -> advanced system settings -> advanced -> environment variables, found in the system path variable value, double-click, add at the end; (note must use English half-width symbols) and enter just find them.
Step Two: Start to write the first program
in the computer, create a new text document, affix into .cs
Here Insert Picture Description
right, choose to use Notepad to open, then enter our code

using System;
namespace hello
{
	class hello
	{
		static void Main()
		{
			Console.WriteLine("hello,world");
			Console.ReadLine();
		}
	}
}

Write code in a text document, must pay attention to the case of
well-known program run out of the print hello on the console, then how to run it, click on the win key + r to open the Run window, type cmd, found on the console you just write location of the file, such as my position is in E: \, then I input
Here Insert Picture Description
after write csc / out :: <filename .exe> on the console <filename .cs>
the first file name that you compile after the application name, and the second is the name of your code file as
you can Here Insert Picture Description
see on my computer has been generated application called hello.exe of running can view our code, of course, if you have the syntax error, cmd example, I now also being given to delete a brace
Here Insert Picture Description
ctrl + s to save the compiled files can be seen
Here Insert Picture Description
hello.cs <17,2>: error cs1513: enter}
'll get an error on the command line prompt change that is wrong can.
Of course, at compile time csc / out :: <filename .exe> <filename .cs>, the first angle brackets can be changed to .exe .dll, it becomes a class library.

Released eight original articles · won praise 5 · Views 325

Guess you like

Origin blog.csdn.net/carrotc/article/details/104116655